kernel swap accounting...

Vladimir Murzin murzin.v at gmail.com
Tue Jan 31 10:38:43 EST 2012


Hi!

AFAIK, shared pages usually get in swap cache first and stay there till page reference count reaches limit. As soon as it is reached page is swapped out on disk.

P.S. Sorry for posting reply over original message. E-mail client on my handheld device isn't configurable enough :-( 
------Original Message------
From: Mulyadi Santosa
Sender: kernelnewbies-bounces at kernelnewbies.org
To: kernelnewbies
Subject: kernel swap accounting...
Sent: 31 Jan 2012 18:02

Hi all

Recently I dig out my old script that count the total number of
swapped out pages. Basically, the script looks like this (sorry for
any obvious typo):
for a in /proc/[0-9]*
do strings $a/cmdline;
        echo ;
        grep Swap $a/smaps |  awk '{ SUM += $2 } END { print SUM }';
        echo ----------------;
done

the problem is: the total number of swapped out pages (in kilobytes)
doesn't match the output of "free" (swap used column). The difference
is not really big, it ranges around 1-2 megabytes in my measurements.

Anybody knows why?

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Best wishes,
Vladimir Murzin


More information about the Kernelnewbies mailing list