diff options
author | Vladimir Davydov <vdavydov@parallels.com> | 2014-04-07 18:39:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-07 19:36:12 -0400 |
commit | 5722d094ad2b56fa2c1cb3adaf40071a55bbf242 (patch) | |
tree | fbae9cdc8bf4d92d2ac268cf761b5f25c5ad6ef9 /mm/slab_common.c | |
parent | a44cb9449182fd7b25bf5f1cc38b7f19e0b96f6d (diff) |
memcg, slab: cleanup memcg cache creation
This patch cleans up the memcg cache creation path as follows:
- Move memcg cache name creation to a separate function to be called
from kmem_cache_create_memcg(). This allows us to get rid of the mutex
protecting the temporary buffer used for the name formatting, because
the whole cache creation path is protected by the slab_mutex.
- Get rid of memcg_create_kmem_cache(). This function serves as a proxy
to kmem_cache_create_memcg(). After separating the cache name creation
path, it would be reduced to a function call, so let's inline it.
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>
Diffstat (limited to 'mm/slab_common.c')
-rw-r--r-- | mm/slab_common.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c index e77b51eb7347..11857abf7057 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
@@ -215,7 +215,10 @@ kmem_cache_create_memcg(struct mem_cgroup *memcg, const char *name, size_t size, | |||
215 | s->align = calculate_alignment(flags, align, size); | 215 | s->align = calculate_alignment(flags, align, size); |
216 | s->ctor = ctor; | 216 | s->ctor = ctor; |
217 | 217 | ||
218 | s->name = kstrdup(name, GFP_KERNEL); | 218 | if (memcg) |
219 | s->name = memcg_create_cache_name(memcg, parent_cache); | ||
220 | else | ||
221 | s->name = kstrdup(name, GFP_KERNEL); | ||
219 | if (!s->name) | 222 | if (!s->name) |
220 | goto out_free_cache; | 223 | goto out_free_cache; |
221 | 224 | ||