[kde-linux] VM and Swap problems

James Richard Tyrer tyrerj at acm.org
Sun Feb 11 06:22:08 UTC 2007


James Richard Tyrer wrote:
> My system has developed an odd problem.
> 
> I have about 1 GByte of disk swap space and 7/16 GByte of RAM.
> 
> 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 don't know if this is a KDE related problem -- perhaps there is 
> something about the way KDE allocates memory that causes the thrashing.
> 
> The system should reclaim swap but it appears that it needs to do it at 
> a higher percentage of the swap space and to do it slower.
> 
> IAC, I think that this is a Kernel issue and that I should be able to 
> configure it by writing a variable in /proc/ somewhere.  But, after 
> reading through the documentation I can't find any info about what to do.
> 
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

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.

-- 
JRT



More information about the kde-linux mailing list