public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Mandeep Singh Baines <msb@chromium.org>
Cc: Tejun Heo <tj@kernel.org>,
	linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org, cgroups@vger.kernel.org,
	Paul Menage <paul@paulmenage.org>
Subject: Re: [PATCH] cgroups: remove redundant get/put of css_set from css_set_check_fetched()
Date: Fri, 16 Dec 2011 10:30:29 +0800	[thread overview]
Message-ID: <4EEAAD45.5030407@cn.fujitsu.com> (raw)
In-Reply-To: <1323987686-17968-1-git-send-email-msb@chromium.org>

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@cn.fujitsu.com>

> Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Li Zefan <lizf@cn.fujitsu.com>
> Cc: containers@lists.linux-foundation.org
> Cc: cgroups@vger.kernel.org
> Cc: Paul Menage <paul@paulmenage.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;
>  }
>  

  reply	other threads:[~2011-12-16  2:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15 22:21 [PATCH] cgroups: remove redundant get/put of css_set from css_set_check_fetched() Mandeep Singh Baines
2011-12-16  2:30 ` Li Zefan [this message]
2011-12-19 17:15 ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EEAAD45.5030407@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=cgroups@vger.kernel.org \
    --cc=containers@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=msb@chromium.org \
    --cc=paul@paulmenage.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox