LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Cedric Le Goater <clg@fr.ibm.com>
Cc: Paul Menage <menage@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Matt Helsley <matthltc@us.ibm.com>,
"Serge E. Hallyn" <serue@us.ibm.com>,
LKML <linux-kernel@vger.kernel.org>,
Linux Containers <containers@lists.linux-foundation.org>
Subject: Re: [PATCH -last version] freezer_cg: disable writing freezer.state of root cgroup
Date: Fri, 07 Nov 2008 14:58:53 +0800 [thread overview]
Message-ID: <4913E72D.3060108@cn.fujitsu.com> (raw)
In-Reply-To: <4912A73C.4080308@fr.ibm.com>
> I would make a small macro is_root_freezer() to show explicitly
> what we are testing and use the CSS_ROOT bit to test. That's what
> the CSS_ROOT bit is for Paul ?
>
I think yes CSS_ROOT can be used, though currently CSS_ROOT is used in
cgroup internal only (in css_get() and css_put()).
> if yes, here's a possible result is below.
>
is_root_freezer() looks a bit better, but I don't have strong option about
this change, the original code and the comment is enough to explain what
we are doing.
> C.
>
> Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
> ---
> kernel/cgroup_freezer.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> Index: 2.6.27-lxc/kernel/cgroup_freezer.c
> ===================================================================
> --- 2.6.27-lxc.orig/kernel/cgroup_freezer.c
> +++ 2.6.27-lxc/kernel/cgroup_freezer.c
> @@ -47,6 +47,11 @@ static inline struct freezer *task_freez
> struct freezer, css);
> }
>
> +static inline int is_root_freezer(struct freezer *freezer)
> +{
> + return test_bit(CSS_ROOT, &freezer->css.flags);
> +}
> +
> int cgroup_frozen(struct task_struct *task)
> {
> struct freezer *freezer;
> @@ -190,6 +195,13 @@ static void freezer_fork(struct cgroup_s
> freezer = task_freezer(task);
> task_unlock(task);
>
> + /*
> + * The root cgroup is non-freezable, so we can skip the
> + * following check.
> + */
> + if (is_root_freezer(freezer))
> + return;
> +
> BUG_ON(freezer->state == CGROUP_FROZEN);
> spin_lock_irq(&freezer->lock);
> /* Locking avoids race with FREEZING -> THAWED transitions. */
> @@ -363,6 +375,9 @@ static struct cftype files[] = {
>
> static int freezer_populate(struct cgroup_subsys *ss, struct cgroup *cgroup)
> {
> + if (is_root_freezer(cgroup_freezer(cgroup)))
> + return 0;
> +
> return cgroup_add_files(cgroup, ss, files, ARRAY_SIZE(files));
> }
>
prev parent reply other threads:[~2008-11-07 7:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-06 1:18 [PATCH -v2] " Li Zefan
2008-11-06 1:24 ` Paul Menage
2008-11-06 1:53 ` Li Zefan
2008-11-06 2:01 ` [PATCH -last version] " Li Zefan
2008-11-06 8:13 ` Cedric Le Goater
2008-11-07 6:58 ` Li Zefan [this message]
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=4913E72D.3060108@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=clg@fr.ibm.com \
--cc=containers@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthltc@us.ibm.com \
--cc=menage@google.com \
--cc=serue@us.ibm.com \
--subject='Re: [PATCH -last version] freezer_cg: disable writing freezer.state of root cgroup' \
/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
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).