aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Davydov <vdavydov@parallels.com>2014-05-06 15:49:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-05-06 16:04:58 -0400
commit93030d83b9e1079836d82b46ab3ec671b1fdb623 (patch)
tree3d67394036bae1fe07c4990fad5fec1668c41213
parent35738392b6c050625e41cc6b941f9828794149b3 (diff)
slub: fix memcg_propagate_slab_attrs
After creating a cache for a memcg we should initialize its sysfs attrs with the values from its parent. That's what memcg_propagate_slab_attrs is for. Currently it's broken - we clearly muddled root-vs-memcg caches there. Let's fix it up. Signed-off-by: Vladimir Davydov <vdavydov@parallels.com> Cc: Christoph Lameter <cl@linux.com> Cc: Pekka Enberg <penberg@kernel.org> 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>
-rw-r--r--mm/slub.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 5e234f1f8853..042a47b4d0f5 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5071,15 +5071,18 @@ static void memcg_propagate_slab_attrs(struct kmem_cache *s)
5071#ifdef CONFIG_MEMCG_KMEM 5071#ifdef CONFIG_MEMCG_KMEM
5072 int i; 5072 int i;
5073 char *buffer = NULL; 5073 char *buffer = NULL;
5074 struct kmem_cache *root_cache;
5074 5075
5075 if (!is_root_cache(s)) 5076 if (is_root_cache(s))
5076 return; 5077 return;
5077 5078
5079 root_cache = s->memcg_params->root_cache;
5080
5078 /* 5081 /*
5079 * This mean this cache had no attribute written. Therefore, no point 5082 * This mean this cache had no attribute written. Therefore, no point
5080 * in copying default values around 5083 * in copying default values around
5081 */ 5084 */
5082 if (!s->max_attr_size) 5085 if (!root_cache->max_attr_size)
5083 return; 5086 return;
5084 5087
5085 for (i = 0; i < ARRAY_SIZE(slab_attrs); i++) { 5088 for (i = 0; i < ARRAY_SIZE(slab_attrs); i++) {
@@ -5101,7 +5104,7 @@ static void memcg_propagate_slab_attrs(struct kmem_cache *s)
5101 */ 5104 */
5102 if (buffer) 5105 if (buffer)
5103 buf = buffer; 5106 buf = buffer;
5104 else if (s->max_attr_size < ARRAY_SIZE(mbuf)) 5107 else if (root_cache->max_attr_size < ARRAY_SIZE(mbuf))
5105 buf = mbuf; 5108 buf = mbuf;
5106 else { 5109 else {
5107 buffer = (char *) get_zeroed_page(GFP_KERNEL); 5110 buffer = (char *) get_zeroed_page(GFP_KERNEL);
@@ -5110,7 +5113,7 @@ static void memcg_propagate_slab_attrs(struct kmem_cache *s)
5110 buf = buffer; 5113 buf = buffer;
5111 } 5114 }
5112 5115
5113 attr->show(s->memcg_params->root_cache, buf); 5116 attr->show(root_cache, buf);
5114 attr->store(s, buf, strlen(buf)); 5117 attr->store(s, buf, strlen(buf));
5115 } 5118 }
5116 5119