pcp
[Top] [All Lists]

proc.runq.swapped

To: pcp developers <pcp@xxxxxxxxxxx>
Subject: proc.runq.swapped
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Thu, 20 Aug 2015 10:09:49 +0300
Delivered-to: pcp@xxxxxxxxxxx
Organization: Red Hat
Reply-to: myllynen@xxxxxxxxxx
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0
Hi,

I'm using this script to see which processes have (parts of) their memory
swapped:

#!/bin/sh
#
# Total swap usage as shown by free(1) and /proc/swaps does not exactly match
# with the swap usage summed up for individual processes as done below due to
# pages in swap cache being included in free(1) and /proc/swaps usage amount.

for p in /proc/[1-9]* ; do
  awk '/^[0-9]+ \(/ {printf "%-8s%-18s", $1, $2; nextfile} \
    /Swap:/ {swap+=$2} END {printf "%8.4f MB\n", swap/1024}' $p/stat $p/smaps \
      2>/dev/null ;
done|sort -gk3|awk '{s=s+$3;print $0}END{printf "Total:%28.4f %s\n", s, "MB"}'

On a busy test system it reports 63 (all being user-land processes) but
proc.runq.swapped is zero. The help text says:

@ proc.runq.swapped number of processes that are swapped
Instantaneous number of processes (excluding kernel threads) that are
swapped, state 'SW' in ps

But the only related reference in the ps(1) man page is:

W    paging (not valid since the 2.6.xx kernel)

So looks like proc.runq.swapped is currently meaningless? Are there any other
ways to find out this kind of information? Is fixing proc.runq.swapped
possible?

Thanks,

-- 
Marko Myllynen

<Prev in Thread] Current Thread [Next in Thread>