From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933173Ab2IROQ4 (ORCPT ); Tue, 18 Sep 2012 10:16:56 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:31173 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933149Ab2IROQx (ORCPT ); Tue, 18 Sep 2012 10:16:53 -0400 From: Glauber Costa To: Cc: , , , Tejun Heo , , Suleiman Souhlal , Frederic Weisbecker , Mel Gorman , David Rientjes , Glauber Costa , Christoph Lameter , Pekka Enberg , Michal Hocko , Johannes Weiner Subject: [PATCH v3 14/16] slub: slub-specific propagation changes. Date: Tue, 18 Sep 2012 18:12:08 +0400 Message-Id: <1347977530-29755-15-git-send-email-glommer@parallels.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1347977530-29755-1-git-send-email-glommer@parallels.com> References: <1347977530-29755-1-git-send-email-glommer@parallels.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a parent cache changes a sysfs attr, we need to propagate that to the children as well. For that, we unfortunately need to tap into the slub core. Signed-off-by: Glauber Costa CC: Christoph Lameter CC: Pekka Enberg CC: Michal Hocko CC: Kamezawa Hiroyuki CC: Johannes Weiner CC: Suleiman Souhlal --- mm/slub.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index f90f612..0b68d15 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -5174,6 +5174,10 @@ static ssize_t slab_attr_store(struct kobject *kobj, struct slab_attribute *attribute; struct kmem_cache *s; int err; +#ifdef CONFIG_MEMCG_KMEM + struct kmem_cache *c; + struct mem_cgroup_cache_params *p; +#endif attribute = to_slab_attr(attr); s = to_slab(kobj); @@ -5182,7 +5186,19 @@ static ssize_t slab_attr_store(struct kobject *kobj, return -EIO; err = attribute->store(s, buf, len); +#ifdef CONFIG_MEMCG_KMEM + if (slab_state < FULL) + return err; + if ((err < 0) || (s->memcg_params.id == -1)) + return err; + + list_for_each_entry(p, &s->memcg_params.sibling_list, sibling_list) { + c = container_of(p, struct kmem_cache, memcg_params); + /* return value determined by the parent cache only */ + attribute->store(c, buf, len); + } +#endif return err; } -- 1.7.11.4