lkml.org 
[lkml]   [1998]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: mmap() versus read()


On Sun, 8 Mar 1998, Kenneth Albanowski wrote:

> My assumption has always been that mmap() isn't well suited for reading
> through a file once (random or sequential doesn't matter), as the kernel
> has no way of knowing that the blocks most recently paged in will probably
> not be needed again any time soon. Perhaps this (if it is an issue) could
> be ameliorated by changing the default page age values based on a
> MAP_DISCARD_EASILY flag.

The ability to give hints to the kernel like you can in OS/2 and WIN32
would be useful -- specifically you can hint that you're going to use a
file sequentially or randomly.

Linus mentioned to me that I could use msync(start, len, MS_INVALIDATE),
and it might help... this seems to do what you're asking for as well. But
it requires an extra syscall every so often, which I'd like to avoid.

In the apache case there's a heuristic the kernel could use because all
the page faults occur as a result of a write() or writev() syscall. But
this doesn't help mmap use in things such as grep.

Dean



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.253 / U:0.732 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site