release used memory

Andreas Leppert wudmx at web.de
Fri Mar 11 12:54:03 EST 2011


Hello,

for study reasons, I evaluate a kernel module by running a parallel version of
bzip. Input data are some senseless data files (500 x 10MB for example). While
the bzip program runs, I took a look at the output of top and noticed
something which I do not understand.

In the following, I'm refering to that two lines of top which look something
like that:

Mem:   8185716k total,  5603224k used,  2582492k free,     9104k buffers
Swap:  8388604k total,        0k used,  8388604k free,  5374400k cached

While the bzip program runs, it uses memory and thus, the value before "free"
in the Mem: line is getting smaller. As you can see above, there is also some
"cached stuff" (5374400k). What is meant by this value? Someone explained me
that it has to do something with filesystem buffers which were read or
written. Could you elaborate on this?

If I have enough input data, the memory is not enough (the "free" value gets
smaller and smaller, and the "cached" value gets bigger and bigger). Then
kswapd appears in the list of running processes. I would expect that Linux
gets rid of the "cached" stuff so that the program gets more memory. Instead,
nothing happens and kswapd is activated. What's the sense of keeping some
filesystem buffers when they are not used anymore?

The main problem is that I do not understand what by "buffers" and "cached" is
meant. It would be nice if you can help me on this.

Thanks in advance
Andreas



More information about the Kernelnewbies mailing list