Re: [patch 6/12] hold atomic kmaps across generic_file_read

Andrew Morton (
Fri, 09 Aug 2002 23:12:38 -0700

Linus Torvalds wrote:
> ...
> > We'll need need to manually fault in the user page on the
> > generic_file_read() path before taking the kmap, because reading
> > into an unmapped page is a common case: malloc/read.
> I actually suspect that most reads are fairly small, and the page already
> exists. But who knows.. pre-loading is certainly easy (a single
> instruction).

These things can be measured ;)

Across a `make -j6 bzImage' the kernel reads 166,000 pages via
file_read_actor(). And 31,000 of those generated a fault in
the copy_*_user. (It wrote 14,400 pages and, of course, none
of those faulted).

And if gcc is getting a fault 20% of the time, some other apps will
get many more. Which implies that we must prefault the page in
file_read_actor to get full benefit.

And if we do that, I'll bet you Victor's dollar that the fixup path
is never executed. I'd have to disable the prefault even to be able
to test it.

What would be nice is a way of formalising the prefault, to pin
the mm's pages across the copy_*_user() in some manner, perhaps?
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at