linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memcg: remove redundant code in mem_cgroup_force_empty_write()
@ 2013-07-25  1:53 Li Zefan
  2013-07-25  8:02 ` Michal Hocko
  0 siblings, 1 reply; 2+ messages in thread
From: Li Zefan @ 2013-07-25  1:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Michal Hocko, KAMEZAWA Hiroyuki, Johannes Weiner, LKML, linux-mm,
	Cgroups, Tejun Heo

vfs guarantees the cgroup won't be destroyed, so it's redundant
to get a css reference.

Signed-off-by: Li Zefan <lizefan@huawei.com>
---
 mm/memcontrol.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 03c8bf7..aa3e478 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5015,15 +5015,10 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg)
 static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int event)
 {
 	struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
-	int ret;
 
 	if (mem_cgroup_is_root(memcg))
 		return -EINVAL;
-	css_get(&memcg->css);
-	ret = mem_cgroup_force_empty(memcg);
-	css_put(&memcg->css);
-
-	return ret;
+	return mem_cgroup_force_empty(memcg);
 }
 
 
-- 
1.8.0.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] memcg: remove redundant code in mem_cgroup_force_empty_write()
  2013-07-25  1:53 [PATCH] memcg: remove redundant code in mem_cgroup_force_empty_write() Li Zefan
@ 2013-07-25  8:02 ` Michal Hocko
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2013-07-25  8:02 UTC (permalink / raw)
  To: Li Zefan
  Cc: Andrew Morton, KAMEZAWA Hiroyuki, Johannes Weiner, LKML,
	linux-mm, Cgroups, Tejun Heo

On Thu 25-07-13 09:53:09, Li Zefan wrote:
> vfs guarantees the cgroup won't be destroyed, so it's redundant
> to get a css reference.
> 
> Signed-off-by: Li Zefan <lizefan@huawei.com>

Acked-by: Michal Hocko <mhocko@suse.cz>

Thanks!

> ---
>  mm/memcontrol.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 03c8bf7..aa3e478 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -5015,15 +5015,10 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg)
>  static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int event)
>  {
>  	struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
> -	int ret;
>  
>  	if (mem_cgroup_is_root(memcg))
>  		return -EINVAL;
> -	css_get(&memcg->css);
> -	ret = mem_cgroup_force_empty(memcg);
> -	css_put(&memcg->css);
> -
> -	return ret;
> +	return mem_cgroup_force_empty(memcg);
>  }
>  
>  
> -- 
> 1.8.0.2

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-25  8:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-25  1:53 [PATCH] memcg: remove redundant code in mem_cgroup_force_empty_write() Li Zefan
2013-07-25  8:02 ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox