This question already has an answer here:

I've got a VM with 16gb of memory and recently it's been using some of the swap space. At first I thought this was because it was using all the memory but then I read some articles about the Cached Memory and how the Linux Kernel uses extra memory for caching. Checked that and saw that I've got about 13gb being allocated to caching. I haven't been able to find any answers though as to why swap is being used. Shouldn't the kernel use memory that is being used as Memory Cache space before it starts using swap space?

Thanks for linking me to that other question, didn't find that for some reason before.

marked as duplicate by maxschlepzig, Stephen Kitt, Anthon, cuonglm, Michael Homer Sep 1 '15 at 7:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


check the swappiness value in :

cat /proc/sys/vm/swappiness

and edit or add if it does not exist

in /etc/sysctl.conf


than reboot.

I also suggest you to read this and this link.

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