aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 930edfaa5187..6678f991c6c6 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3740,14 +3740,11 @@ static void mem_cgroup_force_empty_list(struct mem_cgroup *memcg,
3740 * 3740 *
3741 * Caller is responsible for holding css reference on the memcg. 3741 * Caller is responsible for holding css reference on the memcg.
3742 */ 3742 */
3743static int mem_cgroup_reparent_charges(struct mem_cgroup *memcg) 3743static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
3744{ 3744{
3745 struct cgroup *cgrp = memcg->css.cgroup;
3746 int node, zid; 3745 int node, zid;
3747 3746
3748 do { 3747 do {
3749 if (cgroup_task_count(cgrp) || !list_empty(&cgrp->children))
3750 return -EBUSY;
3751 /* This is for making all *used* pages to be on LRU. */ 3748 /* This is for making all *used* pages to be on LRU. */
3752 lru_add_drain_all(); 3749 lru_add_drain_all();
3753 drain_all_stock_sync(memcg); 3750 drain_all_stock_sync(memcg);
@@ -3773,8 +3770,6 @@ static int mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
3773 * charge before adding to the LRU. 3770 * charge before adding to the LRU.
3774 */ 3771 */
3775 } while (res_counter_read_u64(&memcg->res, RES_USAGE) > 0); 3772 } while (res_counter_read_u64(&memcg->res, RES_USAGE) > 0);
3776
3777 return 0;
3778} 3773}
3779 3774
3780/* 3775/*
@@ -3811,7 +3806,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg)
3811 3806
3812 } 3807 }
3813 lru_add_drain(); 3808 lru_add_drain();
3814 return mem_cgroup_reparent_charges(memcg); 3809 mem_cgroup_reparent_charges(memcg);
3810
3811 return 0;
3815} 3812}
3816 3813
3817static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int event) 3814static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int event)
@@ -5008,13 +5005,9 @@ free_out:
5008static int mem_cgroup_pre_destroy(struct cgroup *cont) 5005static int mem_cgroup_pre_destroy(struct cgroup *cont)
5009{ 5006{
5010 struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); 5007 struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
5011 int ret;
5012 5008
5013 css_get(&memcg->css); 5009 mem_cgroup_reparent_charges(memcg);
5014 ret = mem_cgroup_reparent_charges(memcg); 5010 return 0;
5015 css_put(&memcg->css);
5016
5017 return ret;
5018} 5011}
5019 5012
5020static void mem_cgroup_destroy(struct cgroup *cont) 5013static void mem_cgroup_destroy(struct cgroup *cont)