• Vladimir Davydov's avatar
    cgroup: release css->id after css_free · 01e58659
    Vladimir Davydov authored
    Currently, we release css->id in css_release_work_fn, right before calling
    css_free callback, so that when css_free is called, the id may have
    already been reused for a new cgroup.
    
    I am going to use css->id to create unique names for per memcg kmem
    caches.  Since kmem caches are destroyed only on css_free, I need css->id
    to be freed after css_free was called to avoid name clashes.  This patch
    therefore moves css->id removal to css_free_work_fn.  To prevent
    css_from_id from returning a pointer to a stale css, it makes
    css_release_work_fn replace the css ptr at css_idr:css->id with NULL.
    Signed-off-by: default avatarVladimir Davydov <vdavydov@parallels.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Michal Hocko <mhocko@suse.cz>
    Acked-by: default avatarTejun Heo <tj@kernel.org>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Pekka Enberg <penberg@kernel.org>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: Dave Chinner <david@fromorbit.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    01e58659
cgroup.c 150 KB