Swap has nothing to with CPU utilization. Swap is memory that is written to disk.
The CPU can access normal RAM directly, and RAM is extremely fast compared to swap. That's why we have RAM - as a fast buffer for data the CPU needs to access.
Swap allows the kernel to write unused memory to disk, for retrieval when needed. This is a costly process, as disk is extremely slow compared to memory, but it also allows more memory use than the physical amount of memory.
In addition, some things may never be used, but yet have allocated memory space. Typically the kernel will swap out things that is not used.
190MB used SWAP is not a problem. The problem is if the computer has to write things out to swap, and retrieve it again.
My laptop has 445MB written to swap at the moment, and yet over 3GiB unused memory - obviously the kernel at some stage found something that was not used, and decided to swap it out.
In short: don't care about swap usage unless:
- You see frequent thrashing.
free -m
shows very low amount of available memory
A quick example of free -m
from my laptop:
$ free -m
total used free shared buffers cached
Mem: 7702 7454 247 582 230 3477
-/+ buffers/cache: 3746 3955
Swap: 8191 445 7746
As we can see, there's 247MiB free. But this is not the whole story. In addition, there's over 3GiB of caches, that can be freed very quickly if the kernel needs more memory for something. Thus, the real amount of free memory is 3955MiB, shown in the second line under free
. You also see the swap used.
In short: don't care about swap space usage unless you experience problems, like software responding very slowly - which is a good sign of thrashing.
To check for thrashing, you can run vmstat -s
to display statistics. You'll see two lines, like this:
174085 pages swapped in
569123 pages swapped out
This is the numbers of pages written to swap and read from swap. As long as these numbers are not increasing fast, everything is just fine - and swap gives you more memory for real applications and caching that speeds up your system.