Been going through this topic - https://askubuntu.com/questions/157793/why-is-swap-being-used-even-though-i-have-plenty-of-free-ram.
Turned down swappiness to 10 and then to 0 but my installation is never able to reach out into 70%+ of RAM before turning to the swap area. So I am wrestling my lunix system with the help of that script from the link above, but still no joy. I am getting:
kellogs@kellogs-K52Jc ~/workspace/xgate_git/tigase-server $ sudo unswap.sh Free memory: 1525024 kB (1489 MB) Used swap: 938196 kB (916 MB) Freeing swap... swapoff: /dev/sda4: swapoff failed: Cannot allocate memory
kellogs-K52Jc tigase-server # unswap.sh Free memory: 1212956 kB (1184 MB) Used swap: 478516 kB (467 MB) Freeing swap... swapoff: /dev/sda4: swapoff failed: Cannot allocate memory
It must be something keeping the OS from using the 30% remainder of RAM. But what ?
Original: vm.overcommit_memory = 0 vm.overcommit_ratio = 50
Set to vm.overcommit_memory = 2 vm.overcommit_ratio = 100
And RAM usage would stall at about 50%; After this programs would not launch any longer and complain about memory shortage. Swap remained at 0% usage.
Set to: vm.overcommit_memory = 1 vm.overcommit_ratio = 100
Managed to go to about 83% RAM and 22% swap usage. Then I have called that script for emptying swap-into-RAM and hell broke loose. libflash crashing, the rest of programs unresponsive and having gone into broken pipes and stuff like that.