logo       

Re: Useless kernel caching is annoying me: msg#00912

linux.region.israel

Subject: Re: Useless kernel caching is annoying me

On Sun, Sep 29, 2002, voguemaster wrote about "Re: Useless kernel caching is
annoying me":
> That's kind of odd, especially since programs like winamp and xmms don't cache
> all the files at once. It shouldn't be such a big deal....

I didn't think that xmms was keeping this cache - I thought it might be the
kernel. The idea is that when you read a file it is cached in memory, because
in Unix this is frequently useful behavior (e.g., you typically use the same
programs again and again, the same shared libraries, read the same
configuration files over and over, etc.).

But in some cases, like sequential playing of 3GB of mp3 files, or compiling
the Linux kernel (or another big project), you know in advance that each
file will be read only once, so caching it would be stupid. At best, these
cached files will displaced other more-useful cached pages (such as the
text pages of executables currently running). At worst, these useless cached
files can cause more useful data pages to be swapped out.

It would be nice if I could tell the kernel (e.g., with an open flag, or
another system call) explicitly that a file I'm reading should not be
kept around after I read it, so that the kernel would not need to somehow
guess that on its own. Unfortunately, the O_DIRECT flag to open() doesn't
seem to be exactly what I want because it prevents any readahead (I want
readahead, it is very important for continuous mp3 playing, but I also want
the already-passed pages to be dropped immediately).
Using mmap+madvise(MADV_DONTNEED) instead of read() might work, if the kernel
indeed supports it. Maybe one day I'll try it. I'll also upgrade the kernel
tomorrow (by installing Redhat 8.0 :)) and see if that helps in anything.

--
Nadav Har'El | Sunday, Sep 29 2002, 23 Tishri 5763
nyh-TS7m/3hpY0sOpacJJkBjfT4kX+cae0hd@xxxxxxxxxxxxxxxx
|-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |If God had intended us to be vegetarians,
http://nadav.harel.org.il |He wouldn't have made animals out of meat

=================================================================
To unsubscribe, send mail to
linux-il-request-Xh+NVF5n0LIQhDRD3CWCHA@xxxxxxxxxxxxxxxx with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request-Xh+NVF5n0LIQhDRD3CWCHA@xxxxxxxxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise