memcg, slab: separate memcg vs root cache creation paths
Memcg-awareness turned kmem_cache_create() into a dirty interweaving of memcg-only and except-for-memcg calls. To clean this up, let's move the code responsible for memcg cache creation to a separate function. Signed-off-by: Vladimir Davydov <vdavydov@parallels.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: David Rientjes <rientjes@google.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: Glauber Costa <glommer@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
5722d094ad
commit
794b1248be
@@ -3395,13 +3395,8 @@ static void memcg_create_cache_work_func(struct work_struct *w)
|
||||
struct create_work *cw = container_of(w, struct create_work, work);
|
||||
struct mem_cgroup *memcg = cw->memcg;
|
||||
struct kmem_cache *cachep = cw->cachep;
|
||||
struct kmem_cache *new;
|
||||
|
||||
new = kmem_cache_create_memcg(memcg, cachep->name,
|
||||
cachep->object_size, cachep->align,
|
||||
cachep->flags & ~SLAB_PANIC, cachep->ctor, cachep);
|
||||
if (new)
|
||||
new->allocflags |= __GFP_KMEMCG;
|
||||
kmem_cache_create_memcg(memcg, cachep);
|
||||
css_put(&memcg->css);
|
||||
kfree(cw);
|
||||
}
|
||||
|
Reference in New Issue
Block a user