All of lore.kernel.org
 help / color / mirror / Atom feed
* kernel swap accounting...
@ 2012-01-31 15:02 Mulyadi Santosa
  0 siblings, 0 replies; 3+ messages in thread
From: Mulyadi Santosa @ 2012-01-31 15:02 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* kernel swap accounting...
  2012-01-31 15:38 Vladimir Murzin
@ 2012-01-31 15:49 ` Mulyadi Santosa
  0 siblings, 0 replies; 3+ messages in thread
From: Mulyadi Santosa @ 2012-01-31 15:49 UTC (permalink / raw)
  To: kernelnewbies

hi :)

On Tue, Jan 31, 2012 at 22:38, Vladimir Murzin <murzin.v@gmail.com> wrote:
> 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.

So, what you're trying to say is that: the difference makes sense due
to some pages that end up in swap cache?

AFAIK too, swap cache is pages that once swapout, then brought back to
RAM but still sits in swap too. This is done to save I/O once there's
successive swap out that follows.


-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* kernel swap accounting...
@ 2012-01-31 15:38 Vladimir Murzin
  2012-01-31 15:49 ` Mulyadi Santosa
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Murzin @ 2012-01-31 15:38 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-31 15:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-31 15:02 kernel swap accounting Mulyadi Santosa
2012-01-31 15:38 Vladimir Murzin
2012-01-31 15:49 ` Mulyadi Santosa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.