[CentOS] What is cached swap?

Fri Mar 2 17:39:45 UTC 2007
C. Halstead <chris at sourcelabs.com>

That number is the amount of physical memory that is being used by cache buffers for your filesystems.  It has nothing to do with swap.

Try this trick:

Run top and note the value of 'cached'

run 'dd if=/dev/zero of=~/test bs=1M count=256'

Run top again and see that 'cached' has grown by 256M

remove the file ~/test

Run top again and see that the value of 'cached' has dropped by 256M

With that said, there is a 'SwapCached' value reported in /proc/meminfo that represents the amount of swap space used by pages that are also in physical mem (like if something was swapped out and then back in).  The VMM doesn't clear those swap pages unless they are needed or the process terminates.



C. Halstead <chris at sourcelabs.com>
SourceLabs - http://www.sourcelabs.com
Dependable Open Source Systems

----- "Mike McCarty" <Mike.McCarty at sbcglobal.net> wrote:
> Isn't cached swap somewhat an oxymoron? Why cache virtual?
> Am I misunderstanding this line from top?
> Swap:   524120k total,    80760k used,   443360k free,    73448k
> cached
> Mike
> -- 
> p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
> Oppose globalization and One World Governments like the UN.
> This message made from 100% recycled bits.
> You have found the bank of Larn.
> I can explain it for you, but I can't understand it for you.
> I speak only for myself, and I am unanimous in that!
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos