Re: [PATCH 1/4] memcg, mm: introduce lowlimit reclaim
From: Michal Hocko
Date: Mon May 05 2014 - 10:21:10 EST
On Fri 02-05-14 18:00:56, Johannes Weiner wrote:
> On Fri, May 02, 2014 at 06:49:30PM +0200, Michal Hocko wrote:
> > On Fri 02-05-14 11:58:05, Johannes Weiner wrote:
> > > On Fri, May 02, 2014 at 11:36:28AM +0200, Michal Hocko wrote:
> > > > On Wed 30-04-14 18:55:50, Johannes Weiner wrote:
> > > > > On Mon, Apr 28, 2014 at 02:26:42PM +0200, Michal Hocko wrote:
[...]
> > > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > > > > > index c1cd99a5074b..0f428158254e 100644
> > > > > > --- a/mm/vmscan.c
> > > > > > +++ b/mm/vmscan.c
> > > > [...]
> > > > > > +static void shrink_zone(struct zone *zone, struct scan_control *sc)
> > > > > > +{
> > > > > > + if (!__shrink_zone(zone, sc, true)) {
> > > > > > + /*
> > > > > > + * First round of reclaim didn't find anything to reclaim
> > > > > > + * because of low limit protection so try again and ignore
> > > > > > + * the low limit this time.
> > > > > > + */
> > > > > > + __shrink_zone(zone, sc, false);
> > > > > > + }
> > >
> > > So I don't think this can work as it is, because we are not actually
> > > changing priority levels yet.
> >
> > __shrink_zone returns with 0 only if the whole hierarchy is is under low
> > limit. This means that they are over-committed and it doesn't make much
> > sense to play with priority. Low limit reclaimability is independent on
> > the priority.
> >
> > > It will give up on the guarantees of bigger groups way before smaller
> > > groups are even seriously looked at.
> >
> > How would that happen? Those (smaller) groups would get reclaimed and we
> > wouldn't fallback. Or am I missing your point?
>
> Lol, I hadn't updated my brain to a394cb8ee632 ("memcg,vmscan: do not
> break out targeted reclaim without reclaimed pages") yet... Yes, you
> are right.
You made me think about this more and you are right ;).
The code as is doesn't cope with many racing reclaimers when some
threads can fallback to ignore the lowlimit although there are groups to
scan in the hierarchy but they were visited by other reclaimers.
The patch bellow should help with that. What do you think?
I am also thinking we want to add a fallback counter in memory.stat?
---