I am using Ubuntu as my primary desktop Operating System for last couple of years and finally upgraded to Jaunty last week. I noticed that Jaunty was using a lot of swap at the end of the day. I usually run 8-10 terminal sessions; couple of instances of Firefox; Lotus Notes; Pidgin; OpenOffice & rdesktop and my laptop has 2 GB of RAM which is more than enough to run everything from physical memory. I recalled that I had to change Ubuntu’s swap usage behaviour in Intrepid too. Ubuntu’s kernel uses a parameter called vm.swappiness to figure out how aggressively it should swap processes out to disk. By default vm.swappiness is set to value of 60. I usually set to 5 or 10 but everyone run different applications so you should try different values and figure out the best value for your system. Following is the process to change this parameter:
To get the current value for vm.swappiness
$ sudo sysctl vm.swappiness
OR
cat /proc/sys/vm/swappiness
To change vm.swappiness to 10 for current session (upon restart value will be reset to default value)
sudo sysctl vm.swappiness=10
OR
echo 10 > /proc/sys/vm/swappiness
To set vm.swappiness value permanently to 10 (it will take effect upon reboot)
sudo sysctl -w vm.swappiness=10
OR
sudo vi /etc/sysctl.conf
Search for vm.swappiness and change its value as desired; if vm.swappiness does not exist, add it to the end of the file e.g : vm.swappiness=10
