Re: [PATCH v5 2/7] mm: generalize postponed non-root kmem_cache deactivation

From: Vladimir Davydov
Date: Tue May 28 2019 - 13:14:54 EST


On Tue, May 21, 2019 at 01:07:30PM -0700, Roman Gushchin wrote:
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 6e00bdf8618d..4e5b4292a763 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -866,11 +859,12 @@ static void flush_memcg_workqueue(struct kmem_cache *s)
> mutex_unlock(&slab_mutex);
>
> /*
> - * SLUB deactivates the kmem_caches through call_rcu. Make
> + * SLAB and SLUB deactivate the kmem_caches through call_rcu. Make
> * sure all registered rcu callbacks have been invoked.
> */
> - if (IS_ENABLED(CONFIG_SLUB))
> - rcu_barrier();
> +#ifndef CONFIG_SLOB
> + rcu_barrier();
> +#endif

Nit: you don't need to check CONFIG_SLOB here as this code is under
CONFIG_MEMCG_KMEM which depends on !SLOB.

Other than that, the patch looks good to me, provided using rcu for slab
deactivation proves to be really necessary, although I'd split it in two
patches - one doing renaming another refactoring - easier to review that
way.