Re: Unices are created equal, but ...

Linus Torvalds (
Tue, 16 Apr 1996 09:42:43 +0300 (EET DST)

On 15 Apr 1996, really wrote:
> Linux really has POOR swapping code, and kswap improved
> it insignificantly. This opinion is result of every day experience
> rather than benchmarks. I have Pentium 133 64Mb AIC7881 and run program
> that eats >=128Mb of virtual memory (certainly, matrices).
> It sweaps through these matrices with period ~20min.

Agreed. This is one case where linux doesn't do anything clever at all,
and one place where we should probably do some work. It happens for a lot
of scientific calculations.

The linux swapping code is really written for a more "interactive" load,
with that kind of access patterns. For that kind of load we do ok, it's
only a "special case" that we break on (admittedly it's a not-too-unusual
special case and one we should know about).

Older unixes usually take the other approach: they try to handle
exactly the kind of access pattern you use, because that used to be one
of the "normal" cases (when machines were mostly used for scientific
calculations with working sets >> main memory and very predictable access

Essentially, linux currently does a "interactive workstation" kind of
approach to swapping, where accesses are more or less random. There it
makes sense to use a global LRU-based swap-out algorithm.

With one large process that does sweeps over an array, LRU is just about

We should probably modify the LRU algorithm to take RSS into account (and
possibly access patterns, although that is harder to do). However, to be
quite honest, my personal priority is not that kind of behaviour, so it
would be up to somebody else to implement this.. (hint hint)