From: "Paul Menage" <menage@google.com>
To: "Li Zefan" <lizf@cn.fujitsu.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
"containers@lists.osdl.org" <containers@lists.osdl.org>,
"Balbir Singh" <balbir@linux.vnet.ibm.com>,
"KAMEZAWA Hiroyuki" <kamezawa.hiroyu@jp.fujitsu.com>,
"Paul Jackson" <pj@sgi.com>
Subject: Re: [PATCH] cgroup: support checking of subsystem dependencies (v2)
Date: Thu, 19 Jun 2008 21:51:53 -0700 [thread overview]
Message-ID: <6599ad830806192151wd44a468r242acb3eabe4ce7a@mail.gmail.com> (raw)
In-Reply-To: <4859BBA8.6070808@cn.fujitsu.com>
On Wed, Jun 18, 2008 at 6:51 PM, Li Zefan <lizf@cn.fujitsu.com> wrote:
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Paul Menage <menage@google.com>
Thanks.
> ---
> Documentation/cgroups.txt | 6 ++++++
> include/linux/cgroup.h | 2 ++
> kernel/cgroup.c | 21 ++++++++++++++++++++-
> 3 files changed, 28 insertions(+), 1 deletions(-)
>
> diff --git a/Documentation/cgroups.txt b/Documentation/cgroups.txt
> index 824fc02..8252f5b 100644
> --- a/Documentation/cgroups.txt
> +++ b/Documentation/cgroups.txt
> @@ -530,6 +530,12 @@ and root cgroup. Currently this will only involve movement between
> the default hierarchy (which never has sub-cgroups) and a hierarchy
> that is being created/destroyed (and hence has no sub-cgroups).
>
> +int subsys_depend(struct cgroup_subsys *ss, unsigned long subsys_bits)
> +
> +Called when a cgroup subsystem wants to check if some other subsystems
> +are also present in the proposed hierarchy. If this method returns error,
> +the mount of the cgroup filesystem will fail.
> +
> 4. Questions
> ============
>
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index e155aa7..fc99ba4 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -305,6 +305,8 @@ struct cgroup_subsys {
> struct cgroup *cgrp);
> void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp);
> void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
> + int (*subsys_depend)(struct cgroup_subsys *ss,
> + unsigned long subsys_bits);
> /*
> * This routine is called with the task_lock of mm->owner held
> */
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index 15ac0e1..18e8132 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -774,6 +774,25 @@ static int cgroup_show_options(struct seq_file *seq, struct vfsmount *vfs)
> return 0;
> }
>
> +static int check_subsys_dependency(unsigned long subsys_bits)
> +{
> + int i;
> + int ret;
> + struct cgroup_subsys *ss;
> +
> + for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
> + ss = subsys[i];
> +
> + if (test_bit(i, &subsys_bits) && ss->subsys_depend) {
> + ret = ss->subsys_depend(ss, subsys_bits);
> + if (ret)
> + return ret;
> + }
> + }
> +
> + return 0;
> +}
> +
> struct cgroup_sb_opts {
> unsigned long subsys_bits;
> unsigned long flags;
> @@ -834,7 +853,7 @@ static int parse_cgroupfs_options(char *data,
> if (!opts->subsys_bits)
> return -EINVAL;
>
> - return 0;
> + return check_subsys_dependency(opts->subsys_bits);
> }
>
> static int cgroup_remount(struct super_block *sb, int *flags, char *data)
> --
> 1.5.4.rc3
>
>
next prev parent reply other threads:[~2008-06-20 4:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-18 8:01 [PATCH] cgroup: support checking of subsystem dependencies Li Zefan
2008-06-18 21:13 ` Paul Menage
2008-06-19 0:43 ` Li Zefan
2008-06-19 1:51 ` [PATCH] cgroup: support checking of subsystem dependencies (v2) Li Zefan
2008-06-20 4:51 ` Paul Menage [this message]
2008-07-01 7:51 ` Andrew Morton
2008-07-01 8:43 ` Li Zefan
2008-07-01 8:54 ` Andrew Morton
2008-06-19 0:17 ` [PATCH] cgroup: support checking of subsystem dependencies KAMEZAWA Hiroyuki
2008-06-19 0:40 ` Li Zefan
2008-06-19 2:30 ` Daisuke Nishimura
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=6599ad830806192151wd44a468r242acb3eabe4ce7a@mail.gmail.com \
--to=menage@google.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=containers@lists.osdl.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=pj@sgi.com \
/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
all inboxes | Powered by JetHome®