I have a strange problem that when I run top command it shows that some processes are using around 1.5GB of swap space but then the overall usage of the system swap is way to less to something around 117MB, so why is that? I thought the overall system swap usage is the aggregated usage of all the processes, which doesn't seem to be true in this case. Here's the output:
Tasks: 392 total, 16 running, 373 sleeping, 0 stopped, 3 zombie
Cpu0 : 95.1%us, 4.9%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu1 : 98.0%us, 2.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu2 : 91.1%us, 6.9%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 2.0%si, 0.0%st
Cpu3 : 95.0%us, 3.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 2.0%si, 0.0%st
Mem: 4148160k total, 4007820k used, 140340k free, 15968k buffers
Swap: 4096552k total, 117584k used, 3978968k free, 2909396k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP COMMAND
5784 apache 18 0 1567m 5772 4568 S 0.0 0.1 0:00.03 1.5g C:\windows\system32\explorer.exe /desktop
5776 apache 25 0 1558m 2564 2124 S 0.0 0.1 0:00.00 1.5g C:\windows\system32\winedevice.exe MountMgr 5774 apache 25 0 1558m 2324 1928 S 0.0 0.1 0:00.00 1.5g C:\windows\system32\services.exe
9395 apache 15 0 90536 2988 1340 S 0.0 0.1 0:00.00 85m /usr/sbin/httpd
9419 apache 18 0 90536 2988 1340 S 0.0 0.1 0:00.00 85m /usr/sbin/httpd
27016 apache 18 0 91520 4000 2964 S 0.0 0.1 0:00.04 85m /usr/sbin/httpd
7773 apache 16 0 91012 3592 1464 S 0.0 0.1 0:07.04 85m /usr/sbin/httpd
Best Answer
Top (at least in some versions) calculates SWAP per process as VIRT - RSS instead of reporting real swap usage. Under Linux the result is a completely meaningless number.