diff options
author | Michal Hocko <mhocko@suse.cz> | 2012-10-26 07:37:29 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-10-29 19:22:21 -0400 |
commit | d842301181d9a4486aa24720ed4f96018b213292 (patch) | |
tree | bd2132cd966aaeaa91aaa5ca85cfc24f29061375 /mm/memcontrol.c | |
parent | c26251f9f06d27d1941229d237aca44a0e7b4e42 (diff) |
memcg: root_cgroup cannot reach mem_cgroup_move_parent
The root cgroup cannot be destroyed so we never hit it down the
mem_cgroup_pre_destroy path and mem_cgroup_force_empty_write shouldn't
even try to do anything if called for the root.
This means that mem_cgroup_move_parent doesn't have to bother with the
root cgroup and it can assume it can always move charges upwards.
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Reviewed-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Glauber Costa <glommer@parallels.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 07d92b84f448..916132a29b36 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2715,9 +2715,7 @@ static int mem_cgroup_move_parent(struct page *page, | |||
2715 | unsigned long uninitialized_var(flags); | 2715 | unsigned long uninitialized_var(flags); |
2716 | int ret; | 2716 | int ret; |
2717 | 2717 | ||
2718 | /* Is ROOT ? */ | 2718 | VM_BUG_ON(mem_cgroup_is_root(child)); |
2719 | if (mem_cgroup_is_root(child)) | ||
2720 | return -EINVAL; | ||
2721 | 2719 | ||
2722 | ret = -EBUSY; | 2720 | ret = -EBUSY; |
2723 | if (!get_page_unless_zero(page)) | 2721 | if (!get_page_unless_zero(page)) |
@@ -3823,6 +3821,8 @@ static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int event) | |||
3823 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 3821 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); |
3824 | int ret; | 3822 | int ret; |
3825 | 3823 | ||
3824 | if (mem_cgroup_is_root(memcg)) | ||
3825 | return -EINVAL; | ||
3826 | css_get(&memcg->css); | 3826 | css_get(&memcg->css); |
3827 | ret = mem_cgroup_force_empty(memcg); | 3827 | ret = mem_cgroup_force_empty(memcg); |
3828 | css_put(&memcg->css); | 3828 | css_put(&memcg->css); |