From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx157.postini.com [74.125.245.157]) by kanga.kvack.org (Postfix) with SMTP id A3C316B0044 for ; Sun, 7 Jul 2013 11:57:23 -0400 (EDT) Received: by mail-la0-f43.google.com with SMTP id gw10so3123434lab.2 for ; Sun, 07 Jul 2013 08:57:21 -0700 (PDT) From: Glauber Costa Subject: [PATCH v10 08/16] memcg: move initialization to memcg creation Date: Sun, 7 Jul 2013 11:56:48 -0400 Message-Id: <1373212616-11713-9-git-send-email-glommer@openvz.org> In-Reply-To: <1373212616-11713-1-git-send-email-glommer@openvz.org> References: <1373212616-11713-1-git-send-email-glommer@openvz.org> Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: linux-fsdevel@vger.kernel.org, mgorman@suse.de, david@fromorbit.com, cgroups@vger.kernel.org, kamezawa.hiroyu@jp.fujitsu.com, mhocko@suze.cz, hannes@cmpxchg.org, hughd@google.com, gthelen@google.com, akpm@linux-foundation.org, Glauber Costa , Dave Chinner , Rik van Riel , Michal Hocko 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 Cc: Dave Chinner Cc: Mel Gorman Cc: Rik van Riel Cc: Johannes Weiner Cc: Michal Hocko Cc: Hugh Dickins Cc: Kamezawa Hiroyuki Cc: Andrew Morton --- mm/memcontrol.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index f6b64e8..d853d71 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3173,9 +3173,6 @@ int memcg_update_cache_sizes(struct mem_cgroup *memcg) memcg_update_array_size(num + 1); - INIT_LIST_HEAD(&memcg->memcg_slab_caches); - mutex_init(&memcg->slab_caches_mutex); - return 0; out: ida_simple_remove(&kmem_limited_groups, num); @@ -6085,6 +6082,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.8.2.1 -- 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