Re: Swapping algorithm

David S. Miller (davem@caip.rutgers.edu)
Tue, 23 Apr 1996 22:13:36 -0400


Date: Mon, 22 Apr 96 18:26 BST
From: Jamie Lokier <jamie@rebellion.co.uk>

I like. How about: gather statistics about working sets in the usual
way, based on the usual page faults. Do it better, of course.
Occasionally, unmap a few random pages from random processes, so that
they trigger page faults and add to the statistics. The pages are still
in the page cache, of course, so it doesn't take long to map them back.
Although there is a speed penalty for this, the improved statistics, if
used well, mean that you are far less likely to swap out pages that are
actively in use. How else do you find the working set of a process
without swapping it all to disk?

Or the heuristic could work like this. When we take a page out of a
processes VMA we add a "current-jiffies" marker to the vma when we do
this. The next time we take a fault in that vma we see how long the
jiffies have gone since we took that page away. Using this we decide
later on whether it is a good idea to steal from that vma. And we
re-juvenate these values or retest every so often.

Later,
David S. Miller
davem@caip.rutgers.edu