logo       

Useless kernel caching is annoying me: msg#00907

linux.region.israel

Subject: Useless kernel caching is annoying me

Hi people, I have a question that has been bugging me for quite some time
now.

I'm using Redhat 7.3 and its 2.4.18-3 kernel. I have 128MB of RAM. I
frequently use memory-hogging applications such as Mozilla and OpenOffice.

The phenomenon that annoys me is that many times, after I've left one of
these applications for a bit of time (say, an hour), returning to it requires
a huge amount of swapping and sometimes as much as 10 seconds of wait.

I have a suspicion (based on not-very-scientific experiments) that what is
displacing these applications from memory is my mp3 playing habit. I'm
constantly playing mp3 files (using xmms), and I suspect that the kernel
is caching the files I'm playing in its caches.
Further "evidence" is that "free" normally shows me about 50MB of "cached"
on this machine, and "iostat" shows me swap-out activity once in a while,
closely correlated with the time of disk *reads* (supposedly the time XMMS
reads more of the mp3 file).

Does this make any sense? Does the kernel agree to swap out memory just
to make place for a file that is going to be read once (after all, I won't
play the same file again until about a week will pass)? Or maybe I'm
misunderstanding the problem and it's just that 2.4.18's VM sucks or
something?

If indeed the caching is hurting me, does anybody know any way to control
this useless caching? Does the kernel have any interface to let you open a
file for reading without it being cached? I seem to remember something about
O_DIRECT, but I don't know if it's relevant. Alternatively, is there a way
to limit the amount of memory the kernel will use for disk caching?

Thanks,
Nadav.

--
Nadav Har'El | Sunday, Sep 29 2002, 23 Tishri 5763
nyh-TS7m/3hpY0sOpacJJkBjfT4kX+cae0hd@xxxxxxxxxxxxxxxx
|-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |AlGoreithm, n: Repeating a calculation
http://nadav.harel.org.il |until a prior desired result is produced.

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