Re: [PATCH] mm: vmscan: protect shrinker idr replace with CONFIG_MEMCG

From: Michal Hocko
Date: Thu Dec 05 2019 - 04:43:47 EST


On Thu 05-12-19 11:23:28, Kirill Tkhai wrote:
> On 04.12.2019 22:16, Yang Shi wrote:
> > Since commit 0a432dcbeb32edcd211a5d8f7847d0da7642a8b4 ("mm: shrinker:
> > make shrinker not depend on memcg kmem"), shrinkers' idr is protected by
> > CONFIG_MEMCG instead of CONFIG_MEMCG_KMEM, so it makes no sense to
> > protect shrinker idr replace with CONFIG_MEMCG_KMEM.
> >
> > Cc: Kirill Tkhai <ktkhai@xxxxxxxxxxxxx>
> > Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
> > Cc: Michal Hocko <mhocko@xxxxxxxx>
> > Cc: Shakeel Butt <shakeelb@xxxxxxxxxx>
> > Cc: Roman Gushchin <guro@xxxxxx>
> > Signed-off-by: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx>
>
> It looks like that in CONFIG_SLOB case we do not even call some shrinkers
> for subordinate mem cgroups (i.e., we don't call deferred_split_shrinker),
> since they never become completely registered.
>
> Fixes: 0a432dcbeb32edcd211a5d8f7847d0da7642a8b4 ("mm: shrinker: make shrinker not depend on memcg kmem")

I am confused. Why the Fixes tag? Nothing should be really broken with
KMEM config guard right?

This is a mere clean up AFAICS.

> Reviewed-by: Kirill Tkhai <ktkhai@xxxxxxxxxxxxx>
>
> > ---
> > mm/vmscan.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index ee4eecc..e7f10c4 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -422,7 +422,7 @@ void register_shrinker_prepared(struct shrinker *shrinker)
> > {
> > down_write(&shrinker_rwsem);
> > list_add_tail(&shrinker->list, &shrinker_list);
> > -#ifdef CONFIG_MEMCG_KMEM
> > +#ifdef CONFIG_MEMCG
> > if (shrinker->flags & SHRINKER_MEMCG_AWARE)
> > idr_replace(&shrinker_idr, shrinker, shrinker->id);
> > #endif
> >

--
Michal Hocko
SUSE Labs