Linux – Why is the SWAP listed in the detailed list of the TOP command larger than in the summary?

Why is the SWAP listed in the detailed list of the TOP command larger than in the summary?… here is a solution to the problem.

Why is the SWAP listed in the detailed list of the TOP command larger than in the summary?

TOP command result:

Mem:   3991840k total,  1496328k used,  2495512k free,   156752k buffers  
**Swap**:  3905528k total,     **3980k** used,  3901548k free,   447860k cached  

PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  **SWAP** COMMAND  
28250 www-data  20   0  430m 210m  21m R   63  5.4   0:07.29 **219m** apache2  
28266 www-data  20   0  256m  40m  21m S   30  1.0   0:01.94 **216m** apache2  
28206 www-data  20   0  260m  44m  21m S   27  1.1   0:10.27 **215m** apache2  
28259 www-data  20   0  256m  40m  21m S   26  1.0   0:02.21 **216m** apache2  

The details list shows that a group of apache2 processes are using approximately 210m+ of SWAP memory, but the summary report is only using 3980k. The total SWAP memory in the detailed list is much larger than in the summary. Do these two swaps refer to the same thing?

Solution

Quote from http://www.linuxforums.org/articles/using-top-more-efficiently_89.html :

VIRT=RES+SWAP

As explained previously, VIRT includes anything inside task’s
address space, no matter it is in RAM,
swapped out or still not loaded from
disk. While RES represents total RAM
consumed by this task. So, SWAP here
means it represents the total amount
of data being swapped out OR still not
loaded from disk. Don’t be fooled by
the name, it doesn’t just represent
the swapped out data.

Related Problems and Solutions