Commit a41c58a6 authored by Hillf Danton's avatar Hillf Danton Committed by Linus Torvalds

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: default avatarHillf Danton <dhillf@gmail.com>
Acked-by: default avatarHugh Dickins <hughd@google.com>
Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 481fe17e
...@@ -4907,9 +4907,9 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont) ...@@ -4907,9 +4907,9 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
int cpu; int cpu;
enable_swap_cgroup(); enable_swap_cgroup();
parent = NULL; parent = NULL;
root_mem_cgroup = memcg;
if (mem_cgroup_soft_limit_tree_init()) if (mem_cgroup_soft_limit_tree_init())
goto free_out; goto free_out;
root_mem_cgroup = memcg;
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
struct memcg_stock_pcp *stock = struct memcg_stock_pcp *stock =
&per_cpu(memcg_stock, cpu); &per_cpu(memcg_stock, cpu);
...@@ -4948,7 +4948,6 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont) ...@@ -4948,7 +4948,6 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
return &memcg->css; return &memcg->css;
free_out: free_out:
__mem_cgroup_free(memcg); __mem_cgroup_free(memcg);
root_mem_cgroup = NULL;
return ERR_PTR(error); return ERR_PTR(error);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment