From: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
To: Mandeep Singh Baines <msb-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Paul Menage <paul-inf54ven1CmVyaH7bEyXVA@public.gmane.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-F7+t8E8rja9g9hUCZPvPmw@public.gmane.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-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;
> }
>
WARNING: multiple messages have this Message-ID (diff)
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;
> }
>
next prev parent reply other threads:[~2011-12-16 2:30 UTC|newest]
Thread overview: 7+ 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-15 22:21 ` Mandeep Singh Baines
2011-12-15 22:21 ` Mandeep Singh Baines
[not found] ` <1323987686-17968-1-git-send-email-msb-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2011-12-16 2:30 ` Li Zefan [this message]
2011-12-16 2:30 ` Li Zefan
2011-12-19 17:15 ` Tejun Heo
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-bthxqxjhjhxqfuhtdcdx3a@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=msb-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=paul-inf54ven1CmVyaH7bEyXVA@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.