Skip to content

Commit a41c58a

Browse files
Hillf Dantontorvalds
authored andcommitted
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 <dhillf@gmail.com> Acked-by: Hugh Dickins <hughd@google.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Michal 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 481fe17 commit a41c58a

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎mm/memcontrol.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4907,9 +4907,9 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
49074907
int cpu;
49084908
enable_swap_cgroup();
49094909
parent = NULL;
4910-
root_mem_cgroup = memcg;
49114910
if (mem_cgroup_soft_limit_tree_init())
49124911
goto free_out;
4912+
root_mem_cgroup = memcg;
49134913
for_each_possible_cpu(cpu) {
49144914
struct memcg_stock_pcp *stock =
49154915
&per_cpu(memcg_stock, cpu);
@@ -4948,7 +4948,6 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
49484948
return &memcg->css;
49494949
free_out:
49504950
__mem_cgroup_free(memcg);
4951-
root_mem_cgroup = NULL;
49524951
return ERR_PTR(error);
49534952
}
49544953

0 commit comments

Comments
 (0)