From: Igor Mammedov Date: Wed, 24 Aug 2011 23:47:42 +0000 (+1000) Subject: If somebody is touching data too early, it might be easier to diagnose a X-Git-Tag: next-20110905~1^2~15 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a447ad70eb4b200afeccee7df837128281bdca1d;p=karo-tx-linux.git If somebody is touching data too early, it might be easier to diagnose a problem when dereferencing NULL at mem->info.nodeinfo[node] than trying to understand why mem_cgroup_per_zone is [un|partly]initialized. Signed-off-by: Igor Mammedov Acked-by: Michal Hocko Cc: KAMEZAWA Hiroyuki Signed-off-by: Andrew Morton --- diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 7e38d84f5163..f367fadefe2f 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4905,7 +4905,6 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *memcg, int node) if (!pn) return 1; - memcg->info.nodeinfo[node] = pn; for (zone = 0; zone < MAX_NR_ZONES; zone++) { mz = &pn->zoneinfo[zone]; for_each_lru(l) @@ -4914,6 +4913,7 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *memcg, int node) mz->on_tree = false; mz->mem = memcg; } + memcg->info.nodeinfo[node] = pn; return 0; }