From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com [209.85.217.174]) by kanga.kvack.org (Postfix) with ESMTP id 7A3386B0075 for ; Thu, 20 Feb 2014 02:22:18 -0500 (EST) Received: by mail-lb0-f174.google.com with SMTP id l4so1044581lbv.19 for ; Wed, 19 Feb 2014 23:22:17 -0800 (PST) Received: from relay.parallels.com (relay.parallels.com. [195.214.232.42]) by mx.google.com with ESMTPS id qn8si2900521lbb.168.2014.02.19.23.22.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Feb 2014 23:22:16 -0800 (PST) From: Vladimir Davydov Subject: [PATCH -mm v3 6/7] slub: adjust memcg caches when creating cache alias Date: Thu, 20 Feb 2014 11:22:08 +0400 Message-ID: <0677eab4fd5e0167d799961c95dc68a4df9abc48.1392879001.git.vdavydov@parallels.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain Sender: owner-linux-mm@kvack.org List-ID: To: mhocko@suse.cz, akpm@linux-foundation.org Cc: rientjes@google.com, penberg@kernel.org, cl@linux.com, glommer@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, devel@openvz.org Otherwise, kzalloc() called from a memcg won't clear the whole object. Signed-off-by: Vladimir Davydov --- mm/slub.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index 2f40e615368f..cac2ff7fd68c 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3748,7 +3748,11 @@ __kmem_cache_alias(const char *name, size_t size, size_t align, s = find_mergeable(size, align, flags, name, ctor); if (s) { + int i; + struct kmem_cache *c; + s->refcount++; + /* * Adjust the object sizes so that we clear * the complete object on kzalloc. @@ -3756,6 +3760,15 @@ __kmem_cache_alias(const char *name, size_t size, size_t align, s->object_size = max(s->object_size, (int)size); s->inuse = max_t(int, s->inuse, ALIGN(size, sizeof(void *))); + for_each_memcg_cache_index(i) { + c = cache_from_memcg_idx(s, i); + if (!c) + continue; + c->object_size = s->object_size; + c->inuse = max_t(int, c->inuse, + ALIGN(size, sizeof(void *))); + } + if (sysfs_slab_alias(s, name)) { s->refcount--; s = NULL; -- 1.7.10.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org