Kernel (VM) swap problem in Hoary

Paul M. Bucalo ubuntuser at
Tue May 31 23:09:20 UTC 2005

On Tue, 2005-05-31 at 21:44 +0100, James Wilkinson wrote:
> 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)? 

Yes, to a certain extent. I get varying results with each different
system. I have had at 10 on an FC3 run on the same machine. It prolonged
the inevitable, is all. I currently have it at 90, and I can't seem to
make the thrashing come no matter what I open up. The trade of is
performance, of course...especially on a slow system as this one. I
definitely don't see a clear answer for all desktops, but I wouldn't
mind just a little clarity as to where I should go to make improvements,
you know? :0/ When working on an older, slower box, one assumes
performance is not the first priority. Coming to a standstill for 30
minutes to gain some relatively euphoric moments of computing time
doesn't strike me as good choice. I could be wrong. :0)

> You
> probably want to decrease that. Googling for it turns up
> as the first link.

Interestingly enough, while I found the first page of threads great
reading, the lack of agreement on what is right or wrong only made it
worse. I feel like a guy who has been dragged to every store in the mall
only to be told that what she was looking for wasn't there. ;0)

I'm going to run 10 and 90 alternately for a week. See where it goes.
Running older hardware, I have learned more patience than most. I can
take a hit on performance to be able to work along steadily. Being
locked out of my system for up to 30 minutes regularly, when I have all
my important apps out, is just intolerable. :0/

> Searching with (always a good idea for this sort of thing:
> their writing is *excellent*[1] gives this URL:

More of the same above, but still good reading. Lots of smart people
talking about this problem, which only makes picking a side of the
argument all the more difficult. :0)

> 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.

Clearly! I doubt I know much more today than when I first tried to
tackle this last year. <sigh>

> 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.

Clarvoyant Linux. That has a nice ring to it. Someone needs to you use
that for the name of their newest distro. :0)

> 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.

I like this Andrew. I still can't stop smiling by the impression I get
of him singing incessantly, his fingers in his ears as rocks back and
forth in denial. :0D

Thanks, James, for the URL's and explanations.


More information about the ubuntu-users mailing list