Excessive swapping with 1GB of memory - UBUNTU 12.04 daily build

Phillip Susi psusi at ubuntu.com
Wed Apr 25 19:44:13 UTC 2012


On 4/23/2012 9:28 PM, Gustavo R Leal wrote:
> I believe I've found the solution to excessive swapping with 1GB of memory.
>
> There is a script "/usr/lib/pm-utils/power.d/laptop-mode" that is setting too low values to VM tunable kernel parameters when on AC power:
>
> dirty_background_ratio=5
>
> dirty_ratio=10
>
>
> The line 69 of the script is the following:
>
>          write_values 0 10 5 500
>
> Changing the line with these values resulted in being able to run the system with 1GB without swap partition and good performance even with many large processes running.
>
>          write_values 0 90 20 500
>
> This sets the VM subsystem with these values:
>
> dirty_background_ratio=20
>
> dirty_ratio=90

That makes the dirty_ratio even higher than when on battery.  The 
purpose of tuning these is to allow a laptop on battery to be more 
aggressive about keeping dirty pages in the cache and letting the disk 
stay asleep.  Normally you want dirty pages to be flushed to disk fairly 
quickly.

I'm curious if the normal value of 5 for background ratio but just 
increasing dirty_ratio to 20 or 25 would have a similar effect on your 
performance trouble without going to an excess.

Also if anything, increasing dirty_ratio should make swapping worse, not 
better, since more ram will be tied up in dirty cache pages.  Are you 
sure you have a problem with swapping and not just applications blocking 
while writing data to disk?





More information about the Ubuntu-devel-discuss mailing list