read vs. mmap (or io vs. page faults)

Mikhail Teterin mi+kde at
Sun Jun 20 22:52:18 GMT 2004

On Sunday 20 June 2004 02:35 pm, you wrote:
= :I this how things are supposed to be, or will mmap() become more
= :efficient eventually? Thanks!
= :
= :	-mi

=     It's hard to say.  mmap() could certainly be made more efficient, e.g.
=     by faulting in more pages at a time to reduce the actual fault rate.
=     But it's fairly difficult to beat a read copy into a small buffer.

Well, that's the thing -- by mmap-ing the whole file at once (and by
madvise-ing with MADV_SEQUENTIONAL), I thought, I told, the kernel
everything it needed to know to make the best decision. Why can't
page-faulting code do a better job using all this knowledge, than the
poor read, which only knows about the partial read in question?

I find it so disappointing, that it can, probably, be considered a bug.
I'll try this code on Linux and Solaris. If mmap is better there (as it
really ought to be), we have a problem, IMHO. Thanks!


More information about the freebsd-current mailing list