su -c ‘rm -rf /mnt/proprietary’

November 24, 2011

Linux swapping even if RAM is available..

Filed under: GNU/Linux — krish @ 3:27 pm
Tags: , , , , ,

I noticed this after a very long time, on my laptop today…thought I’d just blog up what to do about it :)

krish@shenron:~$ free
total used free shared buffers cached
Mem: 5717368 1556752 4160616 0 32116 295768
-/+ buffers/cache: 1228868 4488500
Swap: 4296696 156708 4139988

So, that’s pretty much more than 2/3 rds of RAM available, but the swap is being used already.

This setting is controlled by ‘vm.swappiness’
krish@shenron:~$ sysctl -A | grep "vm.swappiness"
vm.swappiness = 60

or you could find the value in
krish@shenron:~$ cat /proc/sys/vm/swappiness
60

The default value is 60.
A value of 0 means “never use swap till RAM is available“ .
A value of 100 would mean “swap as soon as possible”.

Using 0 is bit hard on the machine :D , let’s use a value of 10
krish@shenron:~$ sudo sysctl -w vm.swappiness=10
[sudo] password for krish:
vm.swappiness = 10
.
krish@shenron:~$ sudo sysctl -A | grep "vm.swappiness"
vm.swappiness = 10

This value is not persistent on reboot unless you write it to /etc/sysctl.conf ;)

Advertisement

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.