cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cgroups: remove redundant get/put of css_set from css_set_check_fetched()
@ 2011-12-15 22:21 Mandeep Singh Baines
       [not found] ` <1323987686-17968-1-git-send-email-msb-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Mandeep Singh Baines @ 2011-12-15 22:21 UTC (permalink / raw)
  To: Tejun Heo, Li Zefan, linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Mandeep Singh Baines, Paul Menage, Tejun Heo,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

We already have a reference to all elements in newcg_list.

Signed-off-by: Mandeep Singh Baines <msb-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Paul Menage <paul-inf54ven1CmVyaH7bEyXVA@public.gmane.org>
---
 kernel/cgroup.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index d9d5648..a7e00b9 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1935,23 +1935,17 @@ static bool css_set_check_fetched(struct cgroup *cgrp,
 
 	read_lock(&css_set_lock);
 	newcg = find_existing_css_set(cg, cgrp, template);
-	if (newcg)
-		get_css_set(newcg);
 	read_unlock(&css_set_lock);
 
 	/* doesn't exist at all? */
 	if (!newcg)
 		return false;
 	/* see if it's already in the list */
-	list_for_each_entry(cg_entry, newcg_list, links) {
-		if (cg_entry->cg == newcg) {
-			put_css_set(newcg);
+	list_for_each_entry(cg_entry, newcg_list, links)
+		if (cg_entry->cg == newcg)
 			return true;
-		}
-	}
 
 	/* not found */
-	put_css_set(newcg);
 	return false;
 }
 
-- 
1.7.3.1

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

* Re: [PATCH] cgroups: remove redundant get/put of css_set from css_set_check_fetched()
       [not found] ` <1323987686-17968-1-git-send-email-msb-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2011-12-16  2:30   ` Li Zefan
  2011-12-19 17:15   ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Li Zefan @ 2011-12-16  2:30 UTC (permalink / raw)
  To: Mandeep Singh Baines
  Cc: Tejun Heo, cgroups-u79uwXL29TY76Z2rM5mHXA,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Paul Menage

Mandeep Singh Baines wrote:
> We already have a reference to all elements in newcg_list.
> 

Indeed. The patch looks good to me.

Reviewed-by: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>

> Signed-off-by: Mandeep Singh Baines <msb-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
> Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: Paul Menage <paul-inf54ven1CmVyaH7bEyXVA@public.gmane.org>
> ---
>  kernel/cgroup.c |   10 ++--------
>  1 files changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index d9d5648..a7e00b9 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -1935,23 +1935,17 @@ static bool css_set_check_fetched(struct cgroup *cgrp,
>  
>  	read_lock(&css_set_lock);
>  	newcg = find_existing_css_set(cg, cgrp, template);
> -	if (newcg)
> -		get_css_set(newcg);
>  	read_unlock(&css_set_lock);
>  
>  	/* doesn't exist at all? */
>  	if (!newcg)
>  		return false;
>  	/* see if it's already in the list */
> -	list_for_each_entry(cg_entry, newcg_list, links) {
> -		if (cg_entry->cg == newcg) {
> -			put_css_set(newcg);
> +	list_for_each_entry(cg_entry, newcg_list, links)
> +		if (cg_entry->cg == newcg)
>  			return true;
> -		}
> -	}
>  
>  	/* not found */
> -	put_css_set(newcg);
>  	return false;
>  }
>  

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

* Re: [PATCH] cgroups: remove redundant get/put of css_set from css_set_check_fetched()
       [not found] ` <1323987686-17968-1-git-send-email-msb-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  2011-12-16  2:30   ` Li Zefan
@ 2011-12-19 17:15   ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2011-12-19 17:15 UTC (permalink / raw)
  To: Mandeep Singh Baines
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Paul Menage

On Thu, Dec 15, 2011 at 02:21:26PM -0800, Mandeep Singh Baines wrote:
> We already have a reference to all elements in newcg_list.
> 
> Signed-off-by: Mandeep Singh Baines <msb-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
> Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: Paul Menage <paul-inf54ven1CmVyaH7bEyXVA@public.gmane.org>

Applied to for-3.3.  Thanks.

-- 
tejun

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

end of thread, other threads:[~2011-12-19 17:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-15 22:21 [PATCH] cgroups: remove redundant get/put of css_set from css_set_check_fetched() Mandeep Singh Baines
     [not found] ` <1323987686-17968-1-git-send-email-msb-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2011-12-16  2:30   ` Li Zefan
2011-12-19 17:15   ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).