Linux: how to explicitly unswap everything possible?
Solution 1:
I'd recommend allowing the normal Linux memory control swap in the things that are actually used, as they are used.
The only thing I can think off is to turn swap off, then on again
sudo swapoff -a
sudo swapon -a
That assumes you have enough spare physical memory to contain everything in swap...
Solution 2:
You can tune it echoing some number between 0 to 100 into /proc/sys/vm/swappiness
.
This control is used to define how aggressive the kernel will swap memory pages. Higher values will increase agressiveness, lower values decrease the amount of swap. A value of 0 instructs the kernel not to initiate swap until the amount of free and file-backed pages is less than the high water mark in a zone.
The default value is 60.