top reports wrong swap usage against processes.

Bug #1024135 reported by Joseph Perry on 2012-07-12
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
procps (Ubuntu)
Undecided
Unassigned

Bug Description

Swap total looks correct: 25MB
Swap used by individual processes looks way off. (2.7GB for the first one alone.)

top: procps version 3.2.8

--------------------------
apt-cache show procps

Package: procps
Priority: required
Section: admin
Installed-Size: 668
Maintainer: Ubuntu Developers <email address hidden>
Original-Maintainer: Craig Small <email address hidden>
Architecture: amd64
Version: 1:3.2.8-11ubuntu6

---------------------
output:

Tasks: 262 total, 1 running, 260 sleeping, 0 stopped, 1 zombie
Cpu(s): 5.6%us, 2.8%sy, 0.0%ni, 91.0%id, 0.7%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 4032368k total, 3872416k used, 159952k free, 79252k buffers
Swap: 4175868k total, 25308k used, 4150560k free, 527644k cached

SWAP PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2.7g 3271 joseph 20 0 3172m 415m 20m S 0 10.6 0:29.38 java
2.0g 1601 root 20 0 2042m 3748 2720 S 0 0.1 0:00.06 console-kit-dae
1.8g 2255 archivem 20 0 1860m 16m 5200 S 0 0.4 0:20.37 archivematicaMC
1.3g 2570 joseph 20 0 1409m 119m 43m S 11 3.0 14:16.36 compiz
1.1g 11625 joseph 20 0 1187m 47m 21m S 0 1.2 0:14.32 pidgin
973m 12083 joseph 20 0 1027m 54m 12m S 0 1.4 0:15.45 chrome
948m 1196 mysql 20 0 985m 37m 3300 S 0 0.9 0:06.04 mysqld
866m 21772 joseph 20 0 963m 97m 41m S 0 2.5 0:02.87 chrome
860m 21677 joseph 20 0 912m 52m 21m S 0 1.3 0:03.38 chrome
848m 21049 joseph 20 0 977m 129m 45m S 0 3.3 0:10.34 chrome
847m 21655 joseph 20 0 911m 63m 22m S 0 1.6 0:01.40 chrome
847m 11885 joseph 20 0 900m 52m 19m S 0 1.3 0:02.68 chrome
847m 12325 joseph 20 0 954m 106m 33m S 0 2.7 0:05.15 chrome
845m 21713 joseph 20 0 879m 34m 18m S 0 0.9 0:00.47 chrome
845m 21370 joseph 20 0 902m 57m 20m S 0 1.5 0:05.52 chrome
845m 12318 joseph 20 0 896m 51m 18m S 0 1.3 0:02.36 chrome
844m 21587 joseph 20 0 884m 39m 18m S 0 1.0 0:02.78 chrome
844m 21127 joseph 20 0 877m 32m 17m S 0 0.8 0:00.46 chrome
844m 21725 joseph 20 0 881m 36m 18m S 0 0.9 0:01.18 chrome
844m 21620 joseph 20 0 942m 98m 33m S 0 2.5 0:04.21 chrome
844m 12538 joseph 20 0 895m 50m 19m S 0 1.3 0:00.93 chrome
842m 21384 joseph 20 0 882m 40m 18m S 0 1.0 0:07.44 chrome
842m 21816 joseph 20 0 880m 37m 18m S 0 1.0 0:00.38 chrome
841m 21599 joseph 20 0 877m 35m 17m S 0 0.9 0:00.36 chrome
840m 3211 joseph 20 0 905m 64m 19m S 0 1.6 0:04.66 chrome
840m 21831 joseph 20 0 873m 33m 16m S 0 0.8 0:00.19 chrome
840m 12053 joseph 20 0 893m 52m 19m S 0 1.3 0:02.72 chrome
839m 21667 joseph 20 0 878m 38m 17m S 0 1.0 0:00.39 chrome
839m 21115 joseph 20 0 889m 49m 18m S 0 1.3 0:01.07 chrome
839m 21350 joseph 20 0 883m 43m 18m S 0 1.1 0:00.64 chrome
838m 12071 joseph 20 0 919m 80m 29m S 0 2.0 0:03.54 chrome
838m 12357 joseph 20 0 877m 39m 18m S 0 1.0 0:00.42 chrome
837m 21756 joseph 20 0 894m 56m 19m S 0 1.4 0:00.92 chrome
835m 21641 joseph 20 0 904m 69m 20m S 0 1.8 0:02.38 chrome
834m 3040 joseph 20 0 861m 27m 13m S 0 0.7 0:00.39 chrome
834m 21134 joseph 20 0 877m 43m 19m S 0 1.1 0:01.15 chrome
832m 3029 joseph 20 0 859m 27m 14m S 0 0.7 0:00.25 chrome
832m 12365 joseph 20 0 879m 46m 19m S 0 1.2 0:01.87 chrome
831m 12020 joseph 20 0 875m 44m 18m S 0 1.1 0:00.75 chrome
829m 12062 joseph 20 0 875m 45m 18m S 0 1.2 0:01.00 chrome
793m 2760 joseph 20 0 957m 163m 25m S 0 4.1 0:31.27 thunderbird-bin
721m 2798 joseph 20 0 728m 7432 5368 S 0 0.2 0:01.07 unity-files-dae
714m 2800 joseph 20 0 721m 7256 5068 S 0 0.2 0:00.09 unity-music-dae
711m 2594 joseph 20 0 737m 25m 15m S 0 0.7 0:02.09 nautilus
707m 2854 joseph 20 0 724m 17m 8536 S 0 0.4 0:00.20 unity-scope-vid
656m 2199 archivem 20 0 691m 34m 4880 S 1 0.9 2:23.46 apache2
641m 2550 joseph 20 0 658m 17m 11m S 0 0.4 0:03.38 gnome-settings-
627m 2683 joseph 20 0 633m 6484 4636 S 0 0.2 0:00.60 indicator-messa
613m 3168 joseph 20 0 705m 91m 19m S 0 2.3 0:58.43 firefox
606m 2597 joseph 20 0 645m 39m 18m S 0 1.0 0:00.26 python
571m 2960 joseph 20 0 704m 132m 35m S 2 3.4 3:07.17 chrome

Joseph Perry (berwin22) wrote :

This may be invalid:
       o: VIRT -- Virtual Image (kb)
          The total amount of virtual memory used by the task. It includes all code, data and shared libraries plus pages that have been swapped out and pages that have been mapped but not used.

       p: SWAP -- Swapped size (kb)
           Memory that is not resident but is present in a task. This is memory that has been swapped out but could include additional non-resident memory. This column is calculated by subtracting physical memory from virtual memory.

But how would you get the used swap space of a process?

Joseph Perry (berwin22) wrote :

This is the closest approximation I've found to getting the swap usage of a process:
http://northernmost.org/blog/find-out-what-is-using-your-swap/

This discussion was also very informative:
http://www.linuxquestions.org/questions/linux-server-73/how-to-determine-processes-swap-usage-855360/

I'd like to change this issue to a feature request:
Add non-virtual swap size column.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in procps (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers