Re: Linux disk buffers -- how can we control it?

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Wed, 26 Nov 1997 13:54:20 +0100 (MET)


Rik van Riel wrote:
>
> On Tue, 25 Nov 1997, Pavel Machek wrote:
>
> > > Send Linux memory-management wishes to me: I'm currently looking
> > > for something to hack...
> > Did you think about making linux swapper look after access patterns?
> > It might help *VERY* much in case swap is actually needed. What do you
> > think?
>
> This might be a great win in performance, but I don't have a clue
> as to how to implement this...

Some measures that are important to keep track of, and will be highly
useful are:

- When swapping out a page P, how long ago was page P swapped in?

- Was page P accessed more than once after it was swapped in?

- Last time this page was swapped in, which page was needed after this
one?

The first measure gives an impression about wether the system is
thrashing. If the average age of "pageout pages" drops below 10-60
seconds, you're starting to feel a degradation of performance.

The second measure can be accomplished by removing access to the page
and fixing that on the page fault. (that may be implemented already,
and is very similar to copy-on-write).

This could be done something like every few jiffies. A page that
doesn't get accessed a lot would remain mapped out for a long time,
and become a likely candidate for swapout.

This should help programs that have say a small working set (which
fits into main memory) in addition to scanning a much larger dataset
(which doesn't fit into main memory) in their addressing space.

Adding the "which page was needed next" can help adding read-ahead.

Regards,

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** +31-15-2137555 ** http://www.BitWizard.nl/ **
Florida -- A 39 year old construction worker woke up this morning when a
109-car freight train drove over him. According to the police the man was 
drunk. The man himself claims he slipped while walking the dog. 080897