summaryrefslogtreecommitdiffstats
path: root/mm/slab_common.c
diff options
context:
space:
mode:
authorVladimir Davydov <vdavydov@parallels.com>2015-02-12 17:59:29 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-12 21:54:09 -0500
commitf1008365bbe4931d6a94dcfc11cf4cdada359664 (patch)
treeb82f2b1fcb57d1680b8f5c223c41a98fee4c96ce /mm/slab_common.c
parent01e586598b224d1a427acd8a7afa0b21e879d3a7 (diff)
slab: use css id for naming per memcg caches
Currently, we use mem_cgroup->kmemcg_id to guarantee kmem_cache->name uniqueness. This is correct, because kmemcg_id is only released on css free after destroying all per memcg caches. However, I am going to change that and release kmemcg_id on css offline, because it is not wise to keep it for so long, wasting valuable entries of memcg_cache_params->memcg_caches arrays. Therefore, to preserve cache name uniqueness, let us switch to css->id. Signed-off-by: Vladimir Davydov <vdavydov@parallels.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@suse.cz> Cc: Tejun 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: 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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 989784bd88be..6087b1f9a385 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -488,6 +488,7 @@ void memcg_create_kmem_cache(struct mem_cgroup *memcg,
488 struct kmem_cache *root_cache) 488 struct kmem_cache *root_cache)
489{ 489{
490 static char memcg_name_buf[NAME_MAX + 1]; /* protected by slab_mutex */ 490 static char memcg_name_buf[NAME_MAX + 1]; /* protected by slab_mutex */
491 struct cgroup_subsys_state *css = mem_cgroup_css(memcg);
491 struct memcg_cache_array *arr; 492 struct memcg_cache_array *arr;
492 struct kmem_cache *s = NULL; 493 struct kmem_cache *s = NULL;
493 char *cache_name; 494 char *cache_name;
@@ -510,10 +511,9 @@ void memcg_create_kmem_cache(struct mem_cgroup *memcg,
510 if (arr->entries[idx]) 511 if (arr->entries[idx])
511 goto out_unlock; 512 goto out_unlock;
512 513
513 cgroup_name(mem_cgroup_css(memcg)->cgroup, 514 cgroup_name(css->cgroup, memcg_name_buf, sizeof(memcg_name_buf));
514 memcg_name_buf, sizeof(memcg_name_buf));
515 cache_name = kasprintf(GFP_KERNEL, "%s(%d:%s)", root_cache->name, 515 cache_name = kasprintf(GFP_KERNEL, "%s(%d:%s)", root_cache->name,
516 idx, memcg_name_buf); 516 css->id, memcg_name_buf);
517 if (!cache_name) 517 if (!cache_name)
518 goto out_unlock; 518 goto out_unlock;
519 519