Re: [2.4] heavy-load under swap space shortage

Andrea Arcangeli
2004-03-15T00:13:19Z

On Sun, Mar 14, 2004 at 03:22:53PM -0800, Andrew Morton wrote:
> Andrea Arcangeli <andrea@suse.de> wrote:
> >
> > >
> > > Having a magic knob is a weak solution: the majority of people who are
> > > affected by this problem won't know to turn it on.
> >
> > that's why I turned it _on_ by default in my tree ;)
>
> So maybe Marcelo should apply this patch, and also turn it on by default.

yes, I would suggest so. If anybody can find any swap-regression on
small UP machines then reporting to us on l-k will be welcome. So far
nobody could notice any swap difference at swap regime AFIK, and the
improvement for the fast path is dramatic on the big smp boxes.

> > There are workloads where adding anonymous pages to the lru is
> > suboptimal for both the vm (cache shrinking) and the fast path too
> > (lru_cache_add), not sure how 2.6 optimizes those bits, since with 2.6
> > you're forced to add those pages to the lru somehow and that implies
> > some form of locking.
>
> Basically a bunch of tweeaks:
>
> - Per-zone lru locks (which implicitly made them per-node)

the 16-ways weren't numa, and these days 16-ways HT (8-ways phys) are
not so uncommon anymore.

>
> - Adding/removing sixteen pages for one taking of the lock.
>
> - Making the lock irq-safe (it had to be done for other reasons, but
> reduced contention by 30% on 4-way due to not having a CPU wander off to
> service an interrupt while holding a critical lock).
>
> - In page reclaim, snip 32 pages off the lru completely and drop the
> lock while we go off and process them.

sounds good, thanks.

I don't see other ways to optimize it (and I never enjoyed too much the
per-zone lru since it has some downside too with a worst case on 2G
systems). peraphs a further optimization could be a transient per-cpu
lru refiled only by the page reclaim (so absolutely lazy while lots of
ram is free), but maybe that's already what you're doing when you say
"Adding/removing sixteen pages for one taking of the lock". Though the
fact you say "sixteen pages" sounds like it's not as lazy as it could
be.