Re: [PATCH -mm v2 3/8] memcg: mark caches that belong to offline memcgs as dead

Vladimir Davydov
2014-06-10T10:06:47Z

On Tue, Jun 10, 2014 at 04:48:40PM +0900, Joonsoo Kim wrote:
> On Fri, Jun 06, 2014 at 05:22:40PM +0400, Vladimir Davydov wrote:
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 886b5b414958..ed42fd1105a5 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -3294,6 +3294,7 @@ static void memcg_unregister_all_caches(struct mem_cgroup *memcg)
> > mutex_lock(&memcg_slab_mutex);
> > list_for_each_entry_safe(params, tmp, &memcg->memcg_slab_caches, list) {
> > cachep = memcg_params_to_cache(params);
> > + cachep->memcg_params->dead = true;
>
> I guess that this needs smp_wmb() and memcg_cache_dead() needs
> smp_rmb(), since we could call memcg_cache_dead() without holding any locks.

Good catch! Actually, I thought we always call on_each_cpu, which works
effectively as a full memory barrier, from kmem_cache_shrink, but that's
not always true for SLUB, so we do need the barriers here. Will fix in
the next iteration.

Thanks.