Skip to content

Commit a41c58a

Browse files
Hillf Dantontorvalds
Hillf Danton
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 <[email protected]> Acked-by: Hugh Dickins <[email protected]> Acked-by: KAMEZAWA Hiroyuki <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Balbir Singh <[email protected]> Cc: David Rientjes <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 481fe17 commit a41c58a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

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)