Re: why swap at all?

From: Tom Felker
Date: Thu May 27 2004 - 00:16:32 EST


On Wednesday 26 May 2004 7:37 am, Matthias Schniedermeyer wrote:

> program to kernel: "i read ONCE though this file caching not useful".

Very true. The system is based on the assumption that just-used pages are
more useful that older pages, and it slows when this isn't true. We need
ways to tell the kernel whether the assumption holds.

(What follows are progressively more impossible ideas that I have no idea how
to implement.)

O_STREAMING and a flag to not cache a file when it closes are a good start.

It would also be useful to do this on a per-process basis. For example, you
could set a running shell so that its (and it's children's) files are
O_STREAMING, and use that shell to launch your one-time greps.

Ulimit could set a limit on how much cache a process and its children could
use. (How much overhead this would this entail?) That would take the place
of the above, and it might also be useful for shell server admins who don't
want one user trashing everyone's interactivity.

Most drastic would be to change the way to choose pages to throw out.
Different processes or pages could have different priorities, so you could
mark interactive processes as keepers even if you haven't used them in days.

It's probably impossible because the kernel only knows about faults, but you
could give frequently but not recently used pages (your day-old browser
window) priority over recently but not frequently used pages (your one-time
grep). You'd also need a way to allow cache to grow, which this would
otherwise curtail.

--
Tom Felker, <tcfelker@xxxxxxxx>
<http://vlevel.sourceforge.net> - Stop fiddling with the volume knob.

Alchemists became chemists when they stopped keeping secrets.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/