summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorVladimir Davydov <vdavydov@parallels.com>2014-06-04 16:08:24 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 16:54:06 -0700
commit93f39eea9c229778361ae7ecf5f5e95d291757da (patch)
tree5f4ea6696209c424e58f1a4e7b6f1a695248a9ee /mm
parent073ee1c6cd11cd190f4d0da84d9b4ba79d7b9e70 (diff)
downloadop-kernel-dev-93f39eea9c229778361ae7ecf5f5e95d291757da.zip
op-kernel-dev-93f39eea9c229778361ae7ecf5f5e95d291757da.tar.gz
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')
-rw-r--r--mm/memcontrol.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 7df7f59..5e2bfcc 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3135,7 +3135,8 @@ void memcg_free_cache_params(struct kmem_cache *s)
static void memcg_kmem_create_cache(struct mem_cgroup *memcg,
struct kmem_cache *root_cache)
{
- static char *memcg_name_buf; /* protected by memcg_slab_mutex */
+ static char memcg_name_buf[NAME_MAX + 1]; /* protected by
+ memcg_slab_mutex */
struct kmem_cache *cachep;
int id;
@@ -3151,12 +3152,6 @@ static void memcg_kmem_create_cache(struct mem_cgroup *memcg,
if (cache_from_memcg_idx(root_cache, id))
return;
- if (!memcg_name_buf) {
- memcg_name_buf = kmalloc(NAME_MAX + 1, GFP_KERNEL);
- if (!memcg_name_buf)
- return;
- }
-
cgroup_name(memcg->css.cgroup, memcg_name_buf, NAME_MAX + 1);
cachep = kmem_cache_create_memcg(memcg, root_cache, memcg_name_buf);
/*
OpenPOWER on IntegriCloud