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

Rik van Riel (H.H.vanRiel@phys.uu.nl)
Thu, 17 Dec 1998 08:09:39 +0100 (CET)


On Wed, 16 Dec 1998, Linus Torvalds wrote:
> In article <Pine.LNX.4.03.9812170121030.5325-100000@mirkwood.dummy.home>,
> Rik van Riel <H.H.vanRiel@phys.uu.nl> wrote:
> >
> >It should be a pretty safe bet to assume that we are
> >going in the direction of the lowest page counts --
> >what's already mapped (and has a higher count) is
> >where we came from.
>
> Umm, the easiest hint is probably to just look at the faulting address.
> We have it available, after all.
>
> Basically, if the faulting address is at offset 0 of the page, we're
> probably walking upwards. If it's in the middle, we probably have
> random access. And if it is at the end, the user is probably walking
> downwards.
>
> I suspect that such a simple heuristic would be fairly accurate, and it
> can be coupled with other heuristics to further increase the accuracy.

I have a strong feeling that it will miserably fail on
tiled data and on programs where non-page-aligned data
is referenced.

My (just slightly more complicated) algorithm will also
work on these things. Using the offset within the page
might work to, but that hint is a bit too 'local' IMHO...

Using a 16-page (or more?) neighbourhood will give us a
somewhat bigger view on the situation, something more
close to the scale on which the readahead itself is
performed.

Then again, I'm just a physics student and you're a CS
person :) Maybe Alan, Ingo, Stephen or DaveM have something
useful to say as well...

regards,

Rik -- the flu hits, the flu hits, the flu hits -- MORE
+-------------------------------------------------------------------+
| Linux memory management tour guide. H.H.vanRiel@phys.uu.nl |
| Scouting Vries cubscout leader. http://www.phys.uu.nl/~riel/ |
+-------------------------------------------------------------------+

-
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/