LWN.net Logo

2.6 swapping behavior

2.6 swapping behavior

Posted May 11, 2004 1:28 UTC (Tue) by mcelrath (guest, #8094)
In reply to: 2.6 swapping behavior by iabervon
Parent article: 2.6 swapping behavior

updatedb (and many other applications) need to be using O_DIRECT or some other flag that indicates explicitly that files will be read exactly once, and putting the file in the buffer cache isn't necessary.

There is no way for the kernel to predict that some process named 'updatedb' will read every file exactly once, but another process named 'mozilla' likes to read the same file over and over. It's up to the application to specify that.

AFAIK O_DIRECT is not the appropriate flag for this, because read/write buffers must be page aligned to use it. An O_NOCACHE flag has been proposed before (especially by streaming video folks) but has not been added, though I did see an implementation once. I think an O_NOCACHE or O_READONCE is the solution to this...


(Log in to post comments)

2.6 swapping behavior

Posted May 13, 2004 21:00 UTC (Thu) by jzhao (guest, #2865) [Link]

Robert Love had a patch which does exactly this:

http://www.kernel.org/pub/linux/kernel/people/rml/O_STREAMING/README

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds