From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by kanga.kvack.org (Postfix) with ESMTP id 25D616B0072 for ; Mon, 2 Dec 2013 06:20:03 -0500 (EST) Received: by mail-la0-f43.google.com with SMTP id n7so8388177lam.30 for ; Mon, 02 Dec 2013 03:20:02 -0800 (PST) Received: from relay.parallels.com (relay.parallels.com. [195.214.232.42]) by mx.google.com with ESMTPS id bj6si1728179lbc.107.2013.12.02.03.20.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Dec 2013 03:20:01 -0800 (PST) From: Vladimir Davydov Subject: [PATCH v12 03/18] memcg: move initialization to memcg creation Date: Mon, 2 Dec 2013 15:19:38 +0400 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain Sender: owner-linux-mm@kvack.org List-ID: To: hannes@cmpxchg.org, mhocko@suse.cz, dchinner@redhat.com, akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, devel@openvz.org, glommer@openvz.org, vdavydov@parallels.com, Balbir Singh , KAMEZAWA Hiroyuki From: Glauber Costa Those structures are only used for memcgs that are effectively using kmemcg. However, in a later patch I intend to use scan that list inconditionally (list empty meaning no kmem caches present), which simplifies the code a lot. So move the initialization to early kmem creation. Signed-off-by: Glauber Costa Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Balbir Singh Cc: KAMEZAWA Hiroyuki --- mm/memcontrol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 144cb4c..3a4e2f8 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3122,8 +3122,6 @@ int memcg_update_cache_sizes(struct mem_cgroup *memcg) } memcg->kmemcg_id = num; - INIT_LIST_HEAD(&memcg->memcg_slab_caches); - mutex_init(&memcg->slab_caches_mutex); return 0; } @@ -5909,6 +5907,8 @@ static int memcg_init_kmem(struct mem_cgroup *memcg, struct cgroup_subsys *ss) { int ret; + INIT_LIST_HEAD(&memcg->memcg_slab_caches); + mutex_init(&memcg->slab_caches_mutex); memcg->kmemcg_id = -1; ret = memcg_propagate_kmem(memcg); if (ret) -- 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