Hi All,
I made a script few days back to find the process using the Swap in RHEL. I used the /proc/<pid>/smaps file and then extracting the Swap from it. Below is the script
Code:
for i in /proc/*/smaps ; do awk '/Swap/ {sum += $2}; END{ print FILENAME " Total: " sum}' $i; done | sort -nr -k 3
ANd it worked fine on most systems, but today i came across a system where the Swap was full so i ran the script but script didn't show my any results, so i digged into it and found that there is no Swap row in Smaps file. PLease see below
Quote:
# cat /proc/10686/smaps
2b6c5cc6b000-2b6c5ccc5000 r-xp 00000000 fd:01 164061 /usr/sbin/sshd
Size: 360 kB
Rss: 300 kB
Shared_Clean: 300 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 0 kB
2b6c5cec5000-2b6c5cec8000 rw-p 0005a000 fd:01 164061 /usr/sbin/sshd
Size: 12 kB
Rss: 12 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 12 kB
2b6c5cec8000-2b6c5cecf000 rw-p 2b6c5cec8000 00:00 0
Size: 28 kB
Rss: 28 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 28 kB
|
As you see Swap is missing here. So can anyone please explain how and why Swap is missing here, and then from where Top actually picks up the processes's swap usage.
ANd below is a server where i see two additional rows
Quote:
cat /proc/30513/smaps
00400000-0b459000 r-xp 00000000 fd:09 269727 /u01/app/oracle/product/11.2.0.2/db_1/bin/oracle
Size: 180580 kB
Rss: 11972 kB
Shared_Clean: 11868 kB
Shared_Dirty: 0 kB
Private_Clean: 104 kB
Private_Dirty: 0 kB
Swap: 0 kB
Pss: 475 kB0b658000-0b820000 rwxp 0b058000 fd:09 269727 /u01/app/oracle/product/11.2.0.2/db_1/bin/oracle
Size: 1824 kB
Rss: 272 kB
Shared_Clean: 200 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 72 kB
Swap: 0 kB
Pss: 78 kB0b820000-0b86b000 rwxp 0b820000 00:00 0
Size: 300 kB
Rss: 204 kB
Shared_Clean: 8 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 196 kB
Swap: 0 kB
Pss: 196 kB
|
ANy help ideas,explaination would be highly appreciated.