[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new kswapd logic



On Mon, 2 Mar 1998, Linus Torvalds wrote:
> On Tue, 3 Mar 1998, Rik van Riel wrote:
> > 
> > with my new free_memory_available() patch, it
> > should be possible to put in my kswapd logic
> > patch again.
> 
> Actually, I really think that the _correct_ fix is to make kswapd be a
> very low-priority process that works in the background, rather than be a
> very high-priority process that works in the foreground. 

There's no problem with kswapd being high-priority...
It just shouldn't run for very long periods. We should:
- limit the amount of pages it can try to free
- make sure that it tries more and more as memory becomes
  more and more scarce
- make sure that kswapd doesn't hog resources when it isn't
  neccesary

The first two issues are solved with my patch (have any
of you guys tried it?) and the last one is only partly
adressed.

I will be studying this 'problem' RSN... Maybe kswapd
should limit itself to x% of CPU by keeping it's CPU
statistics around?
(ie. don't use more than 5% CPU over the last 30 seconds,
if memory is still absurdly low, and there's free swap,
just page out _everything_. If there's no free swap and
the page cache is minimal, we need to kill some program)

Rik.
+-----------------------------+------------------------------+
| For Linux mm-patches, go to | "I'm busy managing memory.." |
| my homepage (via LinuxHQ).  | H.H.vanRiel@fys.ruu.nl       |
| ...submissions welcome...   | http://www.fys.ruu.nl/~riel/ |
+-----------------------------+------------------------------+