Linux – Releasing swap space

linuxmemoryswap

At times the kernel seems to be intent on keeping e.g. firefox in swap, even though there is enough physical memory available and I'm using firefox:

robert@rm:~> free -m
             total       used       free     shared    buffers     cached
Mem:          3009       1904       1104          0        109        679
-/+ buffers/cache:       1116       1892
Swap:         4102        885       3216

Is there a command to instruct the kernel to drop swap space and use the available free memory?


Update: although in the short term I've used swapon/swapoff, I now set

sudo sysctl vm.swappiness=30

as suggested in another response, and get very good results.

Best Answer

You could do a swapoff -- will need root privileges,
but, I guess that is not a problem for you.