top - 10:43:31 up 8 days,  1:28,  4 users,  load average: 0.72, 0.57, 0.44
Tasks: 180 total,   1 running, 177 sleeping,   0 stopped,   2 zombie
%Cpu(s):  8.9 us,  2.1 sy,  0.0 ni, 88.9 id,  0.0 wa,  0.0 hi,  0.2 si,  0.0 st
KiB Mem:   8078124 total,  3815444 used,  4262680 free,   108300 buffers
KiB Swap:  9437180 total,  2448032 used,  6989148 free,   446248 cached

PID  USER      PR  NI  VIRT SWAP  RES CODE DATA  SHR S  %CPU %MEM    TIME+  COMMAND                      
3274 root      20   0  160m 4392 6808 2400  80m 1684 S  13.2  0.1 245:09.29 wicd                         
3451 root      20   0 79684 4900 2328 2400 6124  764 S   7.9  0.0 150:21.43 wicd-monitor                 
2804 messageb  20   0 30200  232  856  392  756  408 S   6.6  0.0 128:20.46 dbus-daemon                  
3856 cifer     20   0  411m 7524  28m 2400 150m 5904 S   1.3  0.4  20:34.23 wicd-client                  
4226 cifer     20   0 1499m 197m  52m  86m 1.0g 6504 S   1.3  0.7 227:24.62 chromium   
1087 cifer     20   0 1556m 458m 166m  86m 1.2g 9980 D   2.3  2.1   4:27.35 chromium 

as you can see, I have 8G physical memory and just used 3.8G, I am sure I have never exceeded the 8G spaces, so, I think the 2.4G swap spaces used is just because of hibernating

now, in top command, the VIRT and SWAP column shows that every process has used the swap space, I have add all the processes SWAP column, it seems a little smaller than 2.4G.

Am I right? Is the swap using caused by hibernating?

I have another question that the two chromium processes 's VIRT DATA columns look so high, is this possible?

migrated from serverfault.com Sep 17 '13 at 3:12

This question came from our site for system and network administrators.


Take a look at top's man page:

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. (Note: you 
   can define the STATSIZE=1 environment variable and the VIRT will be 
   calculated  from the /proc/#/state VmSize field.)


p: SWAP  --  Swapped size (kb)
   The swapped out portion of a task's total virtual memory image.

Additionally here's a comment from the ArchLinux Wiki, titled: Suspend and Hibernate.


  • Suspend to RAM method cuts power to most parts of the machine aside from the RAM, which is required to restore the machine's state. Because of the large power savings, it is advisable for laptops to automatically enter this mode when the computer is running on batteries and the lid is closed (or the user is inactive for some time).
  • Suspend to disk method saves the machine's state into swap space and completely powers off the machine. When the machine is powered on, the state is restored. Until then, there is zero power consumption.

Based on those comments I would assume your logic is spot on. I generally never use the hibernate and opt only to use the suspend to RAM method, and so I've never seen a spike in my swap usage, and this makes sense given the above.


$ top
top - 23:40:12 up 15:33,  5 users,  load average: 2.49, 2.62, 2.70
Tasks: 307 total,   3 running, 304 sleeping,   0 stopped,   0 zombie
Cpu(s): 47.6%us,  4.6%sy,  0.0%ni, 47.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   7987492k total,  7528920k used,   458572k free,   161664k buffers
Swap:  5963772k total,    40156k used,  5923616k free,  1100816k cached

I don't think so. Hibernating has nothing to do with swapping apart from using swap space as area to store the data - you can even disable swap (unmount all swap partitions/files) and mount it again only when your system is going into hibernation (there is a small window for a race condition of course).

That said I would think it is much more likely, that at some point before the hibernation the kernel decided that it would make more sense performance-wise to swap out some code pages of programs that were currently not running (or portions of them that haven't been used recently) to make some memory available for data (be it memory allocaetd through malloc(), memmap() or just caches for the filesystem). This depends on your usage patterns and can be controlled e.g. by tweaking the tendency to swap through /proc/sys/vm/swappiness.


VIRT is the size of the virtual memory allocated by the process. This includes everything that the process is mapping: pages in RAM, in swap, shared with other processes, memory-mapped files, and a few more types.

Hibernation works by writing all process data to the swap space. Depending on the hibernation mechanism (Linux has gone through a few), when you resume, some or most data may be kept in the swap. Pages are only loaded back when they're needed, which makes resuming faster.

Note that swapping can happen even if your processes aren't using the whole RAM. RAM isn't just for process memory, it's also for the disk cache and buffers. On a typical system where the amount of available RAM is reasonably close to what is required for the workload, about half the RAM should be used by processes and half by cache at any time. Here, you've just resumed, so your cache is almost empty, it will fill up soon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.