Here is the summary from 'top' command

top - 20:14:50 up 18 days, 23 min, 1 user, load average: 0.22, 0.20, 0.18 Tasks: 99 total, 1 running, 98 sleeping, 0 stopped, 0 zombie Cpu(s): 1.1%us, 0.1%sy, 0.0%ni, 94.2%id, 3.5%wa, 0.0%hi, 0.0%si, 1.2%st Mem: 2092032k total, 471684k used, 1620348k free, 924k buffers Swap: 4194296k total, 153940k used, 4040356k free, 42564k cached

As you can see, out of 2GB memory just around 461MB is used. At the same time it shows 150MB of swap is used.

How is this possible? Why would my server hit swap if there's physical memory free?

2 Answers 2


Under normal circumstances, linux will swap things out when they're not being used, even if there is still free space in RAM. Instead, it'll keep cached files. You can adjust this behaviour by changing vm.swappiness with systctl. More details on the exact details of how this works can be found here.


Linux aggressively swaps out address space which is not actively used for some time. It does so to make more RAM available to filesystem caches (well, actually SLAB caches) or applications using shared memories, a ram disk and so on. Usually, this is exactly what you want.

For further reading, I recommend Linux: Tuning Swappiness for a thorough explanation, although you probably won't have to touch the tunables mentioned there, ever.

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.