aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorVladimir Davydov <vdavydov@parallels.com>2014-06-04 19:08:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 19:54:06 -0400
commit93f39eea9c229778361ae7ecf5f5e95d291757da (patch)
tree5f4ea6696209c424e58f1a4e7b6f1a695248a9ee /mm/memcontrol.c
parent073ee1c6cd11cd190f4d0da84d9b4ba79d7b9e70 (diff)
memcg: memcg_kmem_create_cache: make memcg_name_buf statically allocated
It isn't worth complicating the code by allocating it on the first access, because it only takes 256 bytes. Signed-off-by: Vladimir Davydov <vdavydov@parallels.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 7df7f599e3df..5e2bfcc96da9 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3135,7 +3135,8 @@ void memcg_free_cache_params(struct kmem_cache *s)
3135static void memcg_kmem_create_cache(struct mem_cgroup *memcg, 3135static void memcg_kmem_create_cache(struct mem_cgroup *memcg,
3136 struct kmem_cache *root_cache) 3136 struct kmem_cache *root_cache)
3137{ 3137{
3138 static char *memcg_name_buf; /* protected by memcg_slab_mutex */ 3138 static char memcg_name_buf[NAME_MAX + 1]; /* protected by
3139 memcg_slab_mutex */
3139 struct kmem_cache *cachep; 3140 struct kmem_cache *cachep;
3140 int id; 3141 int id;
3141 3142
@@ -3151,12 +3152,6 @@ static void memcg_kmem_create_cache(struct mem_cgroup *memcg,
3151 if (cache_from_memcg_idx(root_cache, id)) 3152 if (cache_from_memcg_idx(root_cache, id))
3152 return; 3153 return;
3153 3154
3154 if (!memcg_name_buf) {
3155 memcg_name_buf = kmalloc(NAME_MAX + 1, GFP_KERNEL);
3156 if (!memcg_name_buf)
3157 return;
3158 }
3159
3160 cgroup_name(memcg->css.cgroup, memcg_name_buf, NAME_MAX + 1); 3155 cgroup_name(memcg->css.cgroup, memcg_name_buf, NAME_MAX + 1);
3161 cachep = kmem_cache_create_memcg(memcg, root_cache, memcg_name_buf); 3156 cachep = kmem_cache_create_memcg(memcg, root_cache, memcg_name_buf);
3162 /* 3157 /*