Kernel (VM) swap problem in Hoary

James Wilkinson ubuntu at westexe.demon.co.uk
Tue May 31 20:44:42 UTC 2005


Paul M. Bucalo wrote:
> I've had this same problem in FC 3 and couldn't (well, really wasn't
> smart enough) to resolve it: kernel wastes up to 98% of available RAM to
> cache and hold dirty pages too long while memory is desperately needed
> for applications. Then, extensive swap-thrashing that leaves the system
> nearly useless for up to 30 minutes. It seems to be more an issue on the
> desktop with 2.6 kernels.
> 
> There are numerous configuration files in /proc/sys/vm that control this
> issue. I've just not found the magic numbers that should work best for
> my system. I'm running with 256 MB RAM and an AMD K6-2/500 MHz
> processor. (Btw, 'readahead' is active.) 

You've played with the swappiness setting (in /proc/sys/vm)? You
probably want to decrease that. Googling for it turns up
http://kerneltrap.org/node/3000 as the first link.

Searching with site:lwn.net (always a good idea for this sort of thing:
their writing is *excellent*[1] gives this URL:
http://lwn.net/Articles/83588/

One note on the LWN article: "reclaiming". That's what the kernel does
when it needs new pages of memory (either for program use or to cache
something it's loading from disk). If there are spare, totally unused
pages around, it doesn't need to reclaim. It's while reclaiming memory
(either forgetting cached pages or swapping program memory to disk) that
memory policy applies.

> My research hasn't turned up much over the past few months. If anything,
> I get the impression this is still an area of more mysticism than
> science.
It *is* an area of mysticism. And the science, to date, has shown that
it is an area of mysticism.

Ideally, the kernel would cache those pages which will be "most useful"
in the near future. Unfortunately, that requires both that the kernel
should be able to read the *appropriate* users' minds as to what is
"most useful", *and* that it should be clairvoyant: able to accurately
predict what will happen in the future.

James.

[1] Yes, I am a paying subscriber. Quote from that article:
> ... Andrew Morton exclaimed:
>
>       I'm gonna stick my fingers in my ears and sing "la la la" until
>       people tell me "I set swappiness to zero and it didn't do what I
>       wanted it to do".  
>
> This helped quiet the debate as the parties involved looked more
> closely at this particular parameter. Or, perhaps, it was just fear of
> Andrew's singing.

-- 
E-mail address: james | Strangely enough, this last one is interrupted by
@westexe.demon.co.uk  | twelve dancing rabbits singing about toilet paper.
                      |     -- The megahal program, trained on my quote file.




More information about the ubuntu-users mailing list