Lazily add anonymous pages to LRU on v2.4? was Re: [2.4] heavy-load under swap space shortage

Marcelo Tosatti
2004-11-22T19:35:52Z

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.

I've been pondering this again for 2.4.29pre - the thing I'm not sure about
what negative effect will be caused by not adding anonymous pages to LRU
immediately on creation.

The scanning algorithm will apply more pressure to pagecache pages initially
(which are on the LRU) - but that is _hopefully_ no problem because swap_out() will
kick-in soon moving anon pages to LRU soon as they are swap-allocated.

I'm afraid that might be a significant problem for some workloads. No?

Marc-Christian-Petersen claims it improves behaviour for him - how so Marc,
and what is your workload/hardware description?

This is known to decrease contention on pagemap_lru_lock.

Guys, doo you have any further thoughts on this?
I think I'll give it a shot on 2.4.29-pre?

> > 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.