[kde-linux] VM and Swap problems

James Richard Tyrer tyrerj at acm.org
Tue Feb 13 00:06:45 UTC 2007


Randy Kramer wrote:
> On Sunday 11 February 2007 01:22 am, James Richard Tyrer wrote:
>>> The VM and swap work fine till the swap space is half full.  But, after 
>>> swap is half full the system starts removing swap until it is exactly 
>>> half full.  When this happens, the VM system starts to thrash and the 
>>> system won't do anything till the thrashing stops.
> 
> I'm not the OP, but thanks very much--this is useful information.  (But 
> actually, on the next system I set up (and maybe even on this one), I'm going 
> to significantly increase the size of swap so it will take much longer or be 
> less likely to ever get half full.)
> 
>> After some research, I found two idea.
>>
>> 1.      Increase 'swappiness'.  This seems to help a little.  To do this, as 
>> root in a Konsole:
>>
>>         echo 100 > /proc/sys/vm/swappiness
> 
> Hmm, somebody suggested this to me, also, but I went in the other direction 
> (down) and the results weren't very satisfactory (I started using a lot of 
> swap).  I should try this.

This parameter is counter intuitive.  It is the tendency to swap out 
stuff that currently isn't being used.  So, it is then more likely that 
memory will be available without having to swap.

>> 2.      Disable "pflush" daemons from running by default.  This is a very 
>> strange idea but it works.  You have to compile your Kernel to do this. 
>>   In: /usr/src/linux/mm/pflush.c change:
>>
>>         #define MIN_PDFLUSH_THREADS     0
>>         #define MAX_PDFLUSH_THREADS     2
>>
>> I set MAX_PDFLUSH_THREADS to 2 because that is the number of hard disks 
>> that I have.  I don't know if they ever start but this would allow the 
>> Kernel to start them if it wants to.
>>
>> This is a sledge hammer approach and I presume that other changes to 
>> "pflush.c" would accomplish the same result.  So, far, I have not 
>> figured out how it knows to start using "pflush" when stop becomes half 
>> full.
>>
>> After doing these two things my system runs much better.  It gets a bit 
>> sluggish when swap is full, but you would expect that and it isn't as 
>> bad as it was at half full with "pflush" running. 
> 
> Thanks for the above--it's good to hear that there is apparently some logical 
> explanation for the slowdown when swap is half full (and thus it wasn't just 
> my imagination--well, I knew it wasn't my imagination, but it was hard to 
> convince anybody of that).

Unfortunately, I find that after being left on over night to compile 
KDE-3.5 CVS that the problem returned.  Swap was half full and 
performance was poor.  Worse than when I had deliberately filled it, 
after disabling pflush and rebooting, by opening a lot of images in a 
lot of Konqueror windows and tabs.

I restarted KDE and after some web browsing with multiple windows and 
multiple tabs, it was back to the same problem: swap half full (although 
it wasn't being kept *exactly* half full) and poor response time.

So, I gave that idea up.

-- 
JRT



More information about the kde-linux mailing list