mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
memcg: free entries in soft_limit_tree if allocation fails
If we are not able to allocate tree nodes for all NUMA nodes then we should release those that were allocated. Signed-off-by: Michal Hocko <[email protected]> Acked-by: Johannes Weiner <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Balbir Singh <[email protected]> Cc: David Rientjes <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: KAMEZAWA Hiroyuki <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
9fb4b7cc07
commit
c3cecc6834
1 changed files with 11 additions and 1 deletions
|
|
@ -4960,7 +4960,7 @@ static int mem_cgroup_soft_limit_tree_init(void)
|
|||
tmp = -1;
|
||||
rtpn = kzalloc_node(sizeof(*rtpn), GFP_KERNEL, tmp);
|
||||
if (!rtpn)
|
||||
return 1;
|
||||
goto err_cleanup;
|
||||
|
||||
soft_limit_tree.rb_tree_per_node[node] = rtpn;
|
||||
|
||||
|
|
@ -4971,6 +4971,16 @@ static int mem_cgroup_soft_limit_tree_init(void)
|
|||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
err_cleanup:
|
||||
for_each_node_state(node, N_POSSIBLE) {
|
||||
if (!soft_limit_tree.rb_tree_per_node[node])
|
||||
break;
|
||||
kfree(soft_limit_tree.rb_tree_per_node[node]);
|
||||
soft_limit_tree.rb_tree_per_node[node] = NULL;
|
||||
}
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
static struct cgroup_subsys_state * __ref
|
||||
|
|
|
|||
Loading…
Reference in a new issue