login
Header Space

 
 

Mapped Watermark

August 22, 2004 - 8:59am
Submitted by Con Kolivas on August 22, 2004 - 8:59am.
Linux

I've been battling with this swappiness issue and 2.6 for as long as I can remember now. No tuning to the current system seemed optimal and it dawned on me finally how I should approach it to actually behave very well on a desktop. I made a patch I called mapped_watermark.

This patch readjusts the way memory is evicted by lightly removing cached ram once the ram is more than 2/3 full, if less than the "mapped watermark" percent of ram is mapped ram (ie applications). The normal system is to aggresively start scanning ram once it is completely full. The benefits of this are:

1. Allocating memory while ram is being lightly scanned is faster and cheaper than when it is being heavily scanned.
2. There is usually some free ram which tends to speed up application startup times.
3. Swapping is an unusual event instead of a common one if you have enough ram for your workload.
4. It is rare for your applications to be swapped out by file cache pressure.

Disadvantage: Less file cache - but can be offset with the tunable

The mapped watermark is configurable so a server for example might be happy to have a lower mapped percentage. The default is 66 and a server might like 33 (0 is also fine)

echo 33 > /proc/sys/vm/mapped

This patch removes the swappiness knob entirely and deprecates all my previous vm hacks (autoregulated swappiness, hard swappiness, kiflush). Yay!

And probably more important than all that; it works as advertised...

I would like to help make this available for 2.4

August 24, 2004 - 9:50pm

Mr. Kolivas,

I would like to try to help in bringing this to the 2.4 kernel also.

Jeremy knows my email address, and I sent him an email asking him to give it to you. I hope that is OK. This is a great tuning knob for desktop verses server.

Kim Merley

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
speck-geostationary