Consider this real example: top - 12:48:34 up 20 days, 4:00, 11 users, load average: 0.27, 0.34, 0.32 Tasks: 193 total, 3 running, 190 sleeping, 0 stopped, 0 zombie Cpu(s): 7.3%us, 6.0%sy, 0.0%ni, 85.4%id, 1.3%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 1932380k total, 1870388k used, 61992k free, 22264k buffers Swap: 1052248k total, 80k used, 1052168k free, 698684k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP COMMAND 6565 root 20 0 250m 162m 6052 S 0.7 8.6 17:37.54 87m X 23010 anuser 20 0 344m 157m 28m S 1.3 8.3 4:12.36 187m konqueror 30627 anuser 20 0 481m 127m 21m S 1.3 6.7 10:12.45 353m firefox-bin 31305 anuser 20 0 408m 105m 60m S 0.0 5.6 0:13.86 303m soffice.bin 1691 squid 20 0 103m 93m 1812 S 0.0 5.0 20:06.00 10m squid 21553 anuser 20 0 192m 92m 14m S 0.7 4.9 1:27.48 99m konsole 8165 anuser 20 0 190m 89m 8136 S 0.0 4.7 1:23.41 101m stardict 30514 anuser 20 0 244m 79m 24m S 1.3 4.2 2:55.62 164m ktorrent 31242 anuser 20 0 160m 61m 18m S 0.0 3.3 0:22.61 98m akregator 30860 anuser 20 0 186m 61m 17m S 0.7 3.3 1:16.54 124m skype 7007 anuser 20 0 307m 56m 20m S 0.7 3.0 13:07.41 250m plasma-desktop 7024 anuser 20 0 325m 37m 16m S 0.0 2.0 0:07.12 287m krunner 7001 anuser 20 0 262m 33m 16m S 0.0 1.8 0:16.04 228m kwin 21649 anuser 20 0 116m 28m 19m S 0.7 1.5 1:33.68 87m psi 6966 anuser 20 0 192m 27m 10m S 0.0 1.5 0:04.27 164m kded4 7270 anuser 20 0 100m 27m 10m S 0.0 1.4 0:02.13 73m kwalletd 7028 anuser 20 0 101m 26m 10m S 0.0 1.4 0:00.81 74m kmix While swap usage is shown as 80KB (less than 1MB), SWAP column of the TOP output is completely borked.
confirmed
SWAP comes from /proc/*/statm case P_SWP: MKCOL(scale_num(PAGES_TO_KB(p->size - p->resident), w, s));
It's tempting to say that it's top(1) bug. It assumes that page is either in memory or in swap.
I have filed Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=532668 - but as I'm not a (kernel) developer I cannot be sure what is wrong in this case.
OK, it's top(1) bug. > 1691 squid 20 0 103m 93m 1812 S 0.0 5.0 20:06.00 10m squid 103m - 93m = 10m top assumes that everything mapped is resident or in swap, which is wow! it can use /proc/*/pagemap interface to accurately count how many pages were swapped.
Thank you for your investigation, Alexey!