Performance – Why Use Swap When There Is Enough Free RAM

performanceswap

Using swap space instead of RAM can drastically slow down a PC.

So why, when I have more than enough RAM available, does my Linux system (Arch) use the swap?

Checkout my conky output below:

conky output

Also, could this be the cause of speed and system-responsiveness issues I'm having?

Output of free -m :

$ free -m
             total       used       free     shared    buffers     cached
Mem:          1257       1004        252          0         51        778
-/+ buffers/cache:        174       1082
Swap:          502        144        357

Best Answer

It is normal for Linux systems to use some swap even if there is still RAM free. The Linux kernel will move to swap memory pages that are very seldom used (e.g., the getty instances when you only use X11, and some other inactive daemon).

Swap space usage becomes an issue only when there is not enough RAM available, and the kernel is forced to continuously move memory pages to swap and back to RAM, just to keep applications running. In this case, system monitor applications would show a lot of disk I/O activity.

For comparison, my Ubuntu 10.04 system, with two users logged in with X11 sessions both running GNOME desktop, uses ~600MB of swap and ~1GB of RAM (not counting buffers and fs cache), so I'd say that your figures for swap usage look normal.