Re: [PATCH 6/8] memcg: make mem_cgroup_reparent_charges non failing

2012-11-02 Thread Kamezawa Hiroyuki
(2012/11/01 4:44), Tejun Heo wrote:
> From: Michal Hocko 
> 
> Now that pre_destroy callbacks are called from the context where neither
> any task can attach the group nor any children group can be added there
> is no other way to fail from mem_cgroup_pre_destroy.
> mem_cgroup_pre_destroy doesn't have to take a reference to memcg's css
> because all css' are marked dead already.
> 
> tj: Remove now unused local variable @cgrp from
>  mem_cgroup_reparent_charges().
> 
> Signed-off-by: Michal Hocko 
> Reviewed-by: Glauber Costa 
> Signed-off-by: Tejun Heo 

Acked-by: KAMEZAWA Hiroyuki 



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 6/8] memcg: make mem_cgroup_reparent_charges non failing

2012-11-02 Thread Kamezawa Hiroyuki
(2012/10/31 13:22), Tejun Heo wrote:
> From: Michal Hocko 
> 
> Now that pre_destroy callbacks are called from the context where neither
> any task can attach the group nor any children group can be added there
> is no other way to fail from mem_cgroup_pre_destroy.
> mem_cgroup_pre_destroy doesn't have to take a reference to memcg's css
> because all css' are marked dead already.
> 
> tj: Remove now unused local variable @cgrp from
>  mem_cgroup_reparent_charges().
> 
> Signed-off-by: Michal Hocko 
> Reviewed-by: Glauber Costa 
> Signed-off-by: Tejun Heo 

+1
Acked-by: KAMEZAWA Hiroyuki 


> ---
>   mm/memcontrol.c | 19 ++-
>   1 file changed, 6 insertions(+), 13 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 1033b2b..47c4680 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3740,14 +3740,11 @@ static void mem_cgroup_force_empty_list(struct 
> mem_cgroup *memcg,
>*
>* Caller is responsible for holding css reference on the memcg.
>*/
> -static int mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
> +static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
>   {
> - struct cgroup *cgrp = memcg->css.cgroup;
>   int node, zid;
>   
>   do {
> - if (cgroup_task_count(cgrp) || !list_empty(>children))
> - return -EBUSY;
>   /* This is for making all *used* pages to be on LRU. */
>   lru_add_drain_all();
>   drain_all_stock_sync(memcg);
> @@ -3773,8 +3770,6 @@ static int mem_cgroup_reparent_charges(struct 
> mem_cgroup *memcg)
>* charge before adding to the LRU.
>*/
>   } while (res_counter_read_u64(>res, RES_USAGE) > 0);
> -
> - return 0;
>   }
>   
>   /*
> @@ -3811,7 +3806,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup 
> *memcg)
>   
>   }
>   lru_add_drain();
> - return mem_cgroup_reparent_charges(memcg);
> + mem_cgroup_reparent_charges(memcg);
> +
> + return 0;
>   }
>   
>   static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int 
> event)
> @@ -5008,13 +5005,9 @@ free_out:
>   static int mem_cgroup_pre_destroy(struct cgroup *cont)
>   {
>   struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
> - int ret;
>   
> - css_get(>css);
> - ret = mem_cgroup_reparent_charges(memcg);
> - css_put(>css);
> -
> - return ret;
> + mem_cgroup_reparent_charges(memcg);
> + return 0;
>   }
>   
>   static void mem_cgroup_destroy(struct cgroup *cont)
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 6/8] memcg: make mem_cgroup_reparent_charges non failing

2012-11-02 Thread Kamezawa Hiroyuki
(2012/10/31 13:22), Tejun Heo wrote:
 From: Michal Hocko mho...@suse.cz
 
 Now that pre_destroy callbacks are called from the context where neither
 any task can attach the group nor any children group can be added there
 is no other way to fail from mem_cgroup_pre_destroy.
 mem_cgroup_pre_destroy doesn't have to take a reference to memcg's css
 because all css' are marked dead already.
 
 tj: Remove now unused local variable @cgrp from
  mem_cgroup_reparent_charges().
 
 Signed-off-by: Michal Hocko mho...@suse.cz
 Reviewed-by: Glauber Costa glom...@parallels.com
 Signed-off-by: Tejun Heo t...@kernel.org

+1
Acked-by: KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com


 ---
   mm/memcontrol.c | 19 ++-
   1 file changed, 6 insertions(+), 13 deletions(-)
 
 diff --git a/mm/memcontrol.c b/mm/memcontrol.c
 index 1033b2b..47c4680 100644
 --- a/mm/memcontrol.c
 +++ b/mm/memcontrol.c
 @@ -3740,14 +3740,11 @@ static void mem_cgroup_force_empty_list(struct 
 mem_cgroup *memcg,
*
* Caller is responsible for holding css reference on the memcg.
*/
 -static int mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
 +static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
   {
 - struct cgroup *cgrp = memcg-css.cgroup;
   int node, zid;
   
   do {
 - if (cgroup_task_count(cgrp) || !list_empty(cgrp-children))
 - return -EBUSY;
   /* This is for making all *used* pages to be on LRU. */
   lru_add_drain_all();
   drain_all_stock_sync(memcg);
 @@ -3773,8 +3770,6 @@ static int mem_cgroup_reparent_charges(struct 
 mem_cgroup *memcg)
* charge before adding to the LRU.
*/
   } while (res_counter_read_u64(memcg-res, RES_USAGE)  0);
 -
 - return 0;
   }
   
   /*
 @@ -3811,7 +3806,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup 
 *memcg)
   
   }
   lru_add_drain();
 - return mem_cgroup_reparent_charges(memcg);
 + mem_cgroup_reparent_charges(memcg);
 +
 + return 0;
   }
   
   static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int 
 event)
 @@ -5008,13 +5005,9 @@ free_out:
   static int mem_cgroup_pre_destroy(struct cgroup *cont)
   {
   struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
 - int ret;
   
 - css_get(memcg-css);
 - ret = mem_cgroup_reparent_charges(memcg);
 - css_put(memcg-css);
 -
 - return ret;
 + mem_cgroup_reparent_charges(memcg);
 + return 0;
   }
   
   static void mem_cgroup_destroy(struct cgroup *cont)
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 6/8] memcg: make mem_cgroup_reparent_charges non failing

2012-11-02 Thread Kamezawa Hiroyuki
(2012/11/01 4:44), Tejun Heo wrote:
 From: Michal Hocko mho...@suse.cz
 
 Now that pre_destroy callbacks are called from the context where neither
 any task can attach the group nor any children group can be added there
 is no other way to fail from mem_cgroup_pre_destroy.
 mem_cgroup_pre_destroy doesn't have to take a reference to memcg's css
 because all css' are marked dead already.
 
 tj: Remove now unused local variable @cgrp from
  mem_cgroup_reparent_charges().
 
 Signed-off-by: Michal Hocko mho...@suse.cz
 Reviewed-by: Glauber Costa glom...@parallels.com
 Signed-off-by: Tejun Heo t...@kernel.org

Acked-by: KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/8] memcg: make mem_cgroup_reparent_charges non failing

2012-10-31 Thread Tejun Heo
From: Michal Hocko 

Now that pre_destroy callbacks are called from the context where neither
any task can attach the group nor any children group can be added there
is no other way to fail from mem_cgroup_pre_destroy.
mem_cgroup_pre_destroy doesn't have to take a reference to memcg's css
because all css' are marked dead already.

tj: Remove now unused local variable @cgrp from
mem_cgroup_reparent_charges().

Signed-off-by: Michal Hocko 
Reviewed-by: Glauber Costa 
Signed-off-by: Tejun Heo 
---
 mm/memcontrol.c | 19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 930edfa..6678f99 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3740,14 +3740,11 @@ static void mem_cgroup_force_empty_list(struct 
mem_cgroup *memcg,
  *
  * Caller is responsible for holding css reference on the memcg.
  */
-static int mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
+static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
 {
-   struct cgroup *cgrp = memcg->css.cgroup;
int node, zid;
 
do {
-   if (cgroup_task_count(cgrp) || !list_empty(>children))
-   return -EBUSY;
/* This is for making all *used* pages to be on LRU. */
lru_add_drain_all();
drain_all_stock_sync(memcg);
@@ -3773,8 +3770,6 @@ static int mem_cgroup_reparent_charges(struct mem_cgroup 
*memcg)
 * charge before adding to the LRU.
 */
} while (res_counter_read_u64(>res, RES_USAGE) > 0);
-
-   return 0;
 }
 
 /*
@@ -3811,7 +3806,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup 
*memcg)
 
}
lru_add_drain();
-   return mem_cgroup_reparent_charges(memcg);
+   mem_cgroup_reparent_charges(memcg);
+
+   return 0;
 }
 
 static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int 
event)
@@ -5008,13 +5005,9 @@ free_out:
 static int mem_cgroup_pre_destroy(struct cgroup *cont)
 {
struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
-   int ret;
 
-   css_get(>css);
-   ret = mem_cgroup_reparent_charges(memcg);
-   css_put(>css);
-
-   return ret;
+   mem_cgroup_reparent_charges(memcg);
+   return 0;
 }
 
 static void mem_cgroup_destroy(struct cgroup *cont)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/8] memcg: make mem_cgroup_reparent_charges non failing

2012-10-31 Thread Tejun Heo
From: Michal Hocko 

Now that pre_destroy callbacks are called from the context where neither
any task can attach the group nor any children group can be added there
is no other way to fail from mem_cgroup_pre_destroy.
mem_cgroup_pre_destroy doesn't have to take a reference to memcg's css
because all css' are marked dead already.

tj: Remove now unused local variable @cgrp from
mem_cgroup_reparent_charges().

Signed-off-by: Michal Hocko 
Reviewed-by: Glauber Costa 
Signed-off-by: Tejun Heo 
---
 mm/memcontrol.c | 19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1033b2b..47c4680 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3740,14 +3740,11 @@ static void mem_cgroup_force_empty_list(struct 
mem_cgroup *memcg,
  *
  * Caller is responsible for holding css reference on the memcg.
  */
-static int mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
+static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
 {
-   struct cgroup *cgrp = memcg->css.cgroup;
int node, zid;
 
do {
-   if (cgroup_task_count(cgrp) || !list_empty(>children))
-   return -EBUSY;
/* This is for making all *used* pages to be on LRU. */
lru_add_drain_all();
drain_all_stock_sync(memcg);
@@ -3773,8 +3770,6 @@ static int mem_cgroup_reparent_charges(struct mem_cgroup 
*memcg)
 * charge before adding to the LRU.
 */
} while (res_counter_read_u64(>res, RES_USAGE) > 0);
-
-   return 0;
 }
 
 /*
@@ -3811,7 +3806,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup 
*memcg)
 
}
lru_add_drain();
-   return mem_cgroup_reparent_charges(memcg);
+   mem_cgroup_reparent_charges(memcg);
+
+   return 0;
 }
 
 static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int 
event)
@@ -5008,13 +5005,9 @@ free_out:
 static int mem_cgroup_pre_destroy(struct cgroup *cont)
 {
struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
-   int ret;
 
-   css_get(>css);
-   ret = mem_cgroup_reparent_charges(memcg);
-   css_put(>css);
-
-   return ret;
+   mem_cgroup_reparent_charges(memcg);
+   return 0;
 }
 
 static void mem_cgroup_destroy(struct cgroup *cont)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/8] memcg: make mem_cgroup_reparent_charges non failing

2012-10-31 Thread Tejun Heo
From: Michal Hocko mho...@suse.cz

Now that pre_destroy callbacks are called from the context where neither
any task can attach the group nor any children group can be added there
is no other way to fail from mem_cgroup_pre_destroy.
mem_cgroup_pre_destroy doesn't have to take a reference to memcg's css
because all css' are marked dead already.

tj: Remove now unused local variable @cgrp from
mem_cgroup_reparent_charges().

Signed-off-by: Michal Hocko mho...@suse.cz
Reviewed-by: Glauber Costa glom...@parallels.com
Signed-off-by: Tejun Heo t...@kernel.org
---
 mm/memcontrol.c | 19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1033b2b..47c4680 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3740,14 +3740,11 @@ static void mem_cgroup_force_empty_list(struct 
mem_cgroup *memcg,
  *
  * Caller is responsible for holding css reference on the memcg.
  */
-static int mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
+static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
 {
-   struct cgroup *cgrp = memcg-css.cgroup;
int node, zid;
 
do {
-   if (cgroup_task_count(cgrp) || !list_empty(cgrp-children))
-   return -EBUSY;
/* This is for making all *used* pages to be on LRU. */
lru_add_drain_all();
drain_all_stock_sync(memcg);
@@ -3773,8 +3770,6 @@ static int mem_cgroup_reparent_charges(struct mem_cgroup 
*memcg)
 * charge before adding to the LRU.
 */
} while (res_counter_read_u64(memcg-res, RES_USAGE)  0);
-
-   return 0;
 }
 
 /*
@@ -3811,7 +3806,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup 
*memcg)
 
}
lru_add_drain();
-   return mem_cgroup_reparent_charges(memcg);
+   mem_cgroup_reparent_charges(memcg);
+
+   return 0;
 }
 
 static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int 
event)
@@ -5008,13 +5005,9 @@ free_out:
 static int mem_cgroup_pre_destroy(struct cgroup *cont)
 {
struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
-   int ret;
 
-   css_get(memcg-css);
-   ret = mem_cgroup_reparent_charges(memcg);
-   css_put(memcg-css);
-
-   return ret;
+   mem_cgroup_reparent_charges(memcg);
+   return 0;
 }
 
 static void mem_cgroup_destroy(struct cgroup *cont)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/8] memcg: make mem_cgroup_reparent_charges non failing

2012-10-31 Thread Tejun Heo
From: Michal Hocko mho...@suse.cz

Now that pre_destroy callbacks are called from the context where neither
any task can attach the group nor any children group can be added there
is no other way to fail from mem_cgroup_pre_destroy.
mem_cgroup_pre_destroy doesn't have to take a reference to memcg's css
because all css' are marked dead already.

tj: Remove now unused local variable @cgrp from
mem_cgroup_reparent_charges().

Signed-off-by: Michal Hocko mho...@suse.cz
Reviewed-by: Glauber Costa glom...@parallels.com
Signed-off-by: Tejun Heo t...@kernel.org
---
 mm/memcontrol.c | 19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 930edfa..6678f99 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3740,14 +3740,11 @@ static void mem_cgroup_force_empty_list(struct 
mem_cgroup *memcg,
  *
  * Caller is responsible for holding css reference on the memcg.
  */
-static int mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
+static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
 {
-   struct cgroup *cgrp = memcg-css.cgroup;
int node, zid;
 
do {
-   if (cgroup_task_count(cgrp) || !list_empty(cgrp-children))
-   return -EBUSY;
/* This is for making all *used* pages to be on LRU. */
lru_add_drain_all();
drain_all_stock_sync(memcg);
@@ -3773,8 +3770,6 @@ static int mem_cgroup_reparent_charges(struct mem_cgroup 
*memcg)
 * charge before adding to the LRU.
 */
} while (res_counter_read_u64(memcg-res, RES_USAGE)  0);
-
-   return 0;
 }
 
 /*
@@ -3811,7 +3806,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup 
*memcg)
 
}
lru_add_drain();
-   return mem_cgroup_reparent_charges(memcg);
+   mem_cgroup_reparent_charges(memcg);
+
+   return 0;
 }
 
 static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int 
event)
@@ -5008,13 +5005,9 @@ free_out:
 static int mem_cgroup_pre_destroy(struct cgroup *cont)
 {
struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
-   int ret;
 
-   css_get(memcg-css);
-   ret = mem_cgroup_reparent_charges(memcg);
-   css_put(memcg-css);
-
-   return ret;
+   mem_cgroup_reparent_charges(memcg);
+   return 0;
 }
 
 static void mem_cgroup_destroy(struct cgroup *cont)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/8] memcg: make mem_cgroup_reparent_charges non failing

2012-10-30 Thread Tejun Heo
From: Michal Hocko 

Now that pre_destroy callbacks are called from the context where neither
any task can attach the group nor any children group can be added there
is no other way to fail from mem_cgroup_pre_destroy.
mem_cgroup_pre_destroy doesn't have to take a reference to memcg's css
because all css' are marked dead already.

tj: Remove now unused local variable @cgrp from
mem_cgroup_reparent_charges().

Signed-off-by: Michal Hocko 
Reviewed-by: Glauber Costa 
Signed-off-by: Tejun Heo 
---
 mm/memcontrol.c | 19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1033b2b..47c4680 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3740,14 +3740,11 @@ static void mem_cgroup_force_empty_list(struct 
mem_cgroup *memcg,
  *
  * Caller is responsible for holding css reference on the memcg.
  */
-static int mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
+static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
 {
-   struct cgroup *cgrp = memcg->css.cgroup;
int node, zid;
 
do {
-   if (cgroup_task_count(cgrp) || !list_empty(>children))
-   return -EBUSY;
/* This is for making all *used* pages to be on LRU. */
lru_add_drain_all();
drain_all_stock_sync(memcg);
@@ -3773,8 +3770,6 @@ static int mem_cgroup_reparent_charges(struct mem_cgroup 
*memcg)
 * charge before adding to the LRU.
 */
} while (res_counter_read_u64(>res, RES_USAGE) > 0);
-
-   return 0;
 }
 
 /*
@@ -3811,7 +3806,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup 
*memcg)
 
}
lru_add_drain();
-   return mem_cgroup_reparent_charges(memcg);
+   mem_cgroup_reparent_charges(memcg);
+
+   return 0;
 }
 
 static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int 
event)
@@ -5008,13 +5005,9 @@ free_out:
 static int mem_cgroup_pre_destroy(struct cgroup *cont)
 {
struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
-   int ret;
 
-   css_get(>css);
-   ret = mem_cgroup_reparent_charges(memcg);
-   css_put(>css);
-
-   return ret;
+   mem_cgroup_reparent_charges(memcg);
+   return 0;
 }
 
 static void mem_cgroup_destroy(struct cgroup *cont)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/8] memcg: make mem_cgroup_reparent_charges non failing

2012-10-30 Thread Tejun Heo
From: Michal Hocko mho...@suse.cz

Now that pre_destroy callbacks are called from the context where neither
any task can attach the group nor any children group can be added there
is no other way to fail from mem_cgroup_pre_destroy.
mem_cgroup_pre_destroy doesn't have to take a reference to memcg's css
because all css' are marked dead already.

tj: Remove now unused local variable @cgrp from
mem_cgroup_reparent_charges().

Signed-off-by: Michal Hocko mho...@suse.cz
Reviewed-by: Glauber Costa glom...@parallels.com
Signed-off-by: Tejun Heo t...@kernel.org
---
 mm/memcontrol.c | 19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1033b2b..47c4680 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3740,14 +3740,11 @@ static void mem_cgroup_force_empty_list(struct 
mem_cgroup *memcg,
  *
  * Caller is responsible for holding css reference on the memcg.
  */
-static int mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
+static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
 {
-   struct cgroup *cgrp = memcg-css.cgroup;
int node, zid;
 
do {
-   if (cgroup_task_count(cgrp) || !list_empty(cgrp-children))
-   return -EBUSY;
/* This is for making all *used* pages to be on LRU. */
lru_add_drain_all();
drain_all_stock_sync(memcg);
@@ -3773,8 +3770,6 @@ static int mem_cgroup_reparent_charges(struct mem_cgroup 
*memcg)
 * charge before adding to the LRU.
 */
} while (res_counter_read_u64(memcg-res, RES_USAGE)  0);
-
-   return 0;
 }
 
 /*
@@ -3811,7 +3806,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup 
*memcg)
 
}
lru_add_drain();
-   return mem_cgroup_reparent_charges(memcg);
+   mem_cgroup_reparent_charges(memcg);
+
+   return 0;
 }
 
 static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int 
event)
@@ -5008,13 +5005,9 @@ free_out:
 static int mem_cgroup_pre_destroy(struct cgroup *cont)
 {
struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
-   int ret;
 
-   css_get(memcg-css);
-   ret = mem_cgroup_reparent_charges(memcg);
-   css_put(memcg-css);
-
-   return ret;
+   mem_cgroup_reparent_charges(memcg);
+   return 0;
 }
 
 static void mem_cgroup_destroy(struct cgroup *cont)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/