[lug] 'Cache' under linux

Peter Hutnick peter-lists at hutnick.com
Thu Mar 13 21:58:55 MST 2003

jd said:
>> Top should not say "free", it should say "wasted"...  A small free
>> memory pool is kept to satisfy allocations, and the rest of the memory
>> holds cached copies of data that has recently been read from or
>> written to disc, as mentioned elsewhere in this thread...
>> Sean
> since its "wasted" can I make it so more of my ram is cached?
> jd

I presume you mean so that more of you RAM is used for disk cache, or so
that more of your disk is cached.  If you want more of your RAM cached
(assuming you mean system RAM) you need a CPU with a bigger L2 cache ;-)

Two points on that.

1. The disk cache, as I understand it, is opportunistic.  If it isn't
"full" that's because it isn't making wild ass guesses about what you
might want from disk next.  If it is full it is probably mostly due to the
fact that it doesn't cost anything to not expire old guesses that probably
aren't any good any more.  But there is always a chance you will get a
hit, and it doesn't cost you anything.

2. As for the small amount of RAM that is kept unallocated, you probably
don't want to spend that on a .0001% higher cache hit rate at the expense
of having to remove a disk cache entry /first/ every time you need to
allocate any memory.

I'm not a kernel hacker, so everything I say might be bunk.


More information about the LUG mailing list