Re: kernel swap accounting...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


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@xxxxxxxxxxxxxxxxx
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 ----------------;

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?


Mulyadi Santosa
Freelance Linux trainer and consultant


Kernelnewbies mailing list

Best wishes,
Vladimir Murzin
Kernelnewbies mailing list

[Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Networking]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

Add to Google Powered by Linux