From: Hillf Danton Date: Fri, 16 Dec 2011 04:49:24 +0000 (+1100) Subject: memcg: keep root group unchanged if creation fails X-Git-Tag: next-20111219~1^2~249 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2b14e9cf1541415382213d2fa23fc1386f52c41c;p=karo-tx-linux.git memcg: keep root group unchanged if creation fails If the request is to create non-root group and we fail to meet it, we should leave the root unchanged. Signed-off-by: Hillf Danton Acked-by: Hugh Dickins Acked-by: KAMEZAWA Hiroyuki Acked-by: Michal Hocko Cc: Balbir Singh Cc: David Rientjes Cc: Andrea Arcangeli Cc: Johannes Weiner Cc: Signed-off-by: Andrew Morton --- diff --git a/mm/memcontrol.c b/mm/memcontrol.c index d77dce0b4e62..31f2d6c224f4 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5118,9 +5118,9 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont) int cpu; enable_swap_cgroup(); parent = NULL; - root_mem_cgroup = memcg; if (mem_cgroup_soft_limit_tree_init()) goto free_out; + root_mem_cgroup = memcg; for_each_possible_cpu(cpu) { struct memcg_stock_pcp *stock = &per_cpu(memcg_stock, cpu); @@ -5161,7 +5161,6 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont) return &memcg->css; free_out: __mem_cgroup_free(memcg); - root_mem_cgroup = NULL; return ERR_PTR(error); }