Re: mmap() is slower than read() on SCSI/IDE on 2.0 and 2.1

David S. Miller (davem@dm.cobaltmicro.com)
Mon, 14 Dec 1998 05:11:07 -0800


Date: Mon, 14 Dec 1998 05:05:34 -0800
From: "Jay Nordwick" <nordwick@scam.XCF.Berkeley.EDU>

How about cluing in the VM to prefetch with madvise() ? How would this
effect performance?

It's a kludge.

As side questions:
- why would read() do more prefetching than mmap()?

Because no heuristics are there in filemap_nopage past trying to grab
one page ahead if we have to sleep to get the first page.

- If read() caused prefetching of blocks, the when a page faulted in
from an mmap() mapping, why wouldn't this cause prefetching?

You have to "prime" the read prefetcher first by asking for a couple
big chunks via read() first.

- When a binary executable image is mmap()ed to be run, wouldn't you want
to prefetch blocks of code and data -- what would be the difference
between this and the user mmap()ing in a file?

Sure, but what is your limit to pre-faulting pages in? I tried this
once and hit this very problem. FreeBSD and some other systems have a
hard coded limit of the number of pages to do this for as a ceiling, I
think this is not the answer.

The problematic case (and a real life one) is when all of libc has
been faulted into main memory by various processes, when you start one
up do you map in all of libc when it gets mmap'd by the application?
If not, then which if any pages do you choose?

Later,
David S. Miller
davem@dm.cobaltmicro.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/