[olug] Tweaking swapping in 2.6.X kernels...

Christopher Cashell topher at zyp.org
Wed Sep 29 00:37:25 UTC 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At Tue, 28 Sep 04, Unidentified Flying Banana Daniel Linder, said:
> I stumbled across some discussion of the new "swappiness" factor the new
> kernels support via the "/proc" filesystem.  The number that my system was
> set to initially was "60" (it can range from 0 to 100) -- the lower the
> number the more agressively the system will try to hold things in RAM
> before swapping them out.  I lowered this to "25" and the performance is
> extremely responsive now.  You can do this by executing the following as
> root:
> echo 25 > /proc/sys/vm/swappiness
> (You will have to do this each time you reboot, so add the following line
> to your /etc/rc.local once you find a value you like.)

There was a patch floating around the kernel mailing list for an
autoregulating swappiness feature for the kernel, as well.  It adjusts
the swappiness value based on current memory use and activity, and is
said to be greatly beneficial to some people who are running into
problems like yours.

It was written by Con Kolivas[1].  I *think* remember reading that he's
released a new patch that's called something like mapped watermark,
which is supposed to be an improved version of his old patch, with
additional features.  It might be worth checking out.

> These numbers aren't a science yet, so my value might not work in your
> situation, and could easily be a bad value when my system gets an
> newer/different kernel...YMMV.
> Dan

The "best" value can vary a lot depending on how the machine is used.
Desktop-style usage tends to benefit from a lower swappiness, while
oftentimes server, or especially consistent heavy load (compiling large
software) will do best with a higher swappiness.

A great example that was mentioned on lkml a while back was to set your
swappiness to 0, then compile the kernel, then set it to 100, and do the
same.  It will compile noticably faster when swappiness is set to 100,
even though the system itself will "feel" less responsive.

 [1] http://ck.kolivas.org/webpage/
- -- 
| Christopher
+------------------------------------------------+
| Here I stand.  I can do no other.              |
+------------------------------------------------+

-----BEGIN PGP SIGNATURE-----

iD8DBQFBWgPFEhJxA932ZEYRAkUAAJ44WVyn2BCgoCOzRq8drp11IEbcJgCghjHd
1n/9+MIh7xBS5cM/2/lYHf8=
=7l98
-----END PGP SIGNATURE-----



More information about the OLUG mailing list