cgroup: s/CGRP_CLONE_CHILDREN/CGRP_CPUSET_CLONE_CHILDREN/
clone_children is only meaningful for cpuset and will stay that way. Rename the flag to reflect that and update documentation. Also, drop clone_children() wrapper in cgroup.c. The thin wrapper is used only a few times and one of them will go away soon. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com> Acked-by: Li Zefan <lizefan@huawei.com> Cc: Glauber Costa <glommer@parallels.com>
This commit is contained in:
parent
92fb97487a
commit
2260e7fc1f
|
@ -299,11 +299,9 @@ a cgroup hierarchy's release_agent path is empty.
|
||||||
1.5 What does clone_children do ?
|
1.5 What does clone_children do ?
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
If the clone_children flag is enabled (1) in a cgroup, then all
|
This flag only affects the cpuset controller. If the clone_children
|
||||||
cgroups created beneath will call the post_clone callbacks for each
|
flag is enabled (1) in a cgroup, a new cpuset cgroup will copy its
|
||||||
subsystem of the newly created cgroup. Usually when this callback is
|
configuration from the parent during initialization.
|
||||||
implemented for a subsystem, it copies the values of the parent
|
|
||||||
subsystem, this is the case for the cpuset.
|
|
||||||
|
|
||||||
1.6 How do I use cgroups ?
|
1.6 How do I use cgroups ?
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
|
@ -143,9 +143,11 @@ enum {
|
||||||
/* Control Group requires release notifications to userspace */
|
/* Control Group requires release notifications to userspace */
|
||||||
CGRP_NOTIFY_ON_RELEASE,
|
CGRP_NOTIFY_ON_RELEASE,
|
||||||
/*
|
/*
|
||||||
* Clone cgroup values when creating a new child cgroup
|
* Clone the parent's configuration when creating a new child
|
||||||
|
* cpuset cgroup. For historical reasons, this option can be
|
||||||
|
* specified at mount time and thus is implemented here.
|
||||||
*/
|
*/
|
||||||
CGRP_CLONE_CHILDREN,
|
CGRP_CPUSET_CLONE_CHILDREN,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cgroup {
|
struct cgroup {
|
||||||
|
|
|
@ -296,11 +296,6 @@ static int notify_on_release(const struct cgroup *cgrp)
|
||||||
return test_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
|
return test_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int clone_children(const struct cgroup *cgrp)
|
|
||||||
{
|
|
||||||
return test_bit(CGRP_CLONE_CHILDREN, &cgrp->flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* for_each_subsys() allows you to iterate on each subsystem attached to
|
* for_each_subsys() allows you to iterate on each subsystem attached to
|
||||||
* an active hierarchy
|
* an active hierarchy
|
||||||
|
@ -1101,7 +1096,7 @@ static int cgroup_show_options(struct seq_file *seq, struct dentry *dentry)
|
||||||
seq_puts(seq, ",xattr");
|
seq_puts(seq, ",xattr");
|
||||||
if (strlen(root->release_agent_path))
|
if (strlen(root->release_agent_path))
|
||||||
seq_printf(seq, ",release_agent=%s", root->release_agent_path);
|
seq_printf(seq, ",release_agent=%s", root->release_agent_path);
|
||||||
if (clone_children(&root->top_cgroup))
|
if (test_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->top_cgroup.flags))
|
||||||
seq_puts(seq, ",clone_children");
|
seq_puts(seq, ",clone_children");
|
||||||
if (strlen(root->name))
|
if (strlen(root->name))
|
||||||
seq_printf(seq, ",name=%s", root->name);
|
seq_printf(seq, ",name=%s", root->name);
|
||||||
|
@ -1113,7 +1108,7 @@ struct cgroup_sb_opts {
|
||||||
unsigned long subsys_mask;
|
unsigned long subsys_mask;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
char *release_agent;
|
char *release_agent;
|
||||||
bool clone_children;
|
bool cpuset_clone_children;
|
||||||
char *name;
|
char *name;
|
||||||
/* User explicitly requested empty subsystem */
|
/* User explicitly requested empty subsystem */
|
||||||
bool none;
|
bool none;
|
||||||
|
@ -1164,7 +1159,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp(token, "clone_children")) {
|
if (!strcmp(token, "clone_children")) {
|
||||||
opts->clone_children = true;
|
opts->cpuset_clone_children = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp(token, "xattr")) {
|
if (!strcmp(token, "xattr")) {
|
||||||
|
@ -1474,8 +1469,8 @@ static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts)
|
||||||
strcpy(root->release_agent_path, opts->release_agent);
|
strcpy(root->release_agent_path, opts->release_agent);
|
||||||
if (opts->name)
|
if (opts->name)
|
||||||
strcpy(root->name, opts->name);
|
strcpy(root->name, opts->name);
|
||||||
if (opts->clone_children)
|
if (opts->cpuset_clone_children)
|
||||||
set_bit(CGRP_CLONE_CHILDREN, &root->top_cgroup.flags);
|
set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->top_cgroup.flags);
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3905,7 +3900,7 @@ fail:
|
||||||
static u64 cgroup_clone_children_read(struct cgroup *cgrp,
|
static u64 cgroup_clone_children_read(struct cgroup *cgrp,
|
||||||
struct cftype *cft)
|
struct cftype *cft)
|
||||||
{
|
{
|
||||||
return clone_children(cgrp);
|
return test_bit(CGRP_CPUSET_CLONE_CHILDREN, &cgrp->flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cgroup_clone_children_write(struct cgroup *cgrp,
|
static int cgroup_clone_children_write(struct cgroup *cgrp,
|
||||||
|
@ -3913,9 +3908,9 @@ static int cgroup_clone_children_write(struct cgroup *cgrp,
|
||||||
u64 val)
|
u64 val)
|
||||||
{
|
{
|
||||||
if (val)
|
if (val)
|
||||||
set_bit(CGRP_CLONE_CHILDREN, &cgrp->flags);
|
set_bit(CGRP_CPUSET_CLONE_CHILDREN, &cgrp->flags);
|
||||||
else
|
else
|
||||||
clear_bit(CGRP_CLONE_CHILDREN, &cgrp->flags);
|
clear_bit(CGRP_CPUSET_CLONE_CHILDREN, &cgrp->flags);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4130,8 +4125,8 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
|
||||||
if (notify_on_release(parent))
|
if (notify_on_release(parent))
|
||||||
set_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
|
set_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
|
||||||
|
|
||||||
if (clone_children(parent))
|
if (test_bit(CGRP_CPUSET_CLONE_CHILDREN, &parent->flags))
|
||||||
set_bit(CGRP_CLONE_CHILDREN, &cgrp->flags);
|
set_bit(CGRP_CPUSET_CLONE_CHILDREN, &cgrp->flags);
|
||||||
|
|
||||||
for_each_subsys(root, ss) {
|
for_each_subsys(root, ss) {
|
||||||
struct cgroup_subsys_state *css;
|
struct cgroup_subsys_state *css;
|
||||||
|
@ -4148,7 +4143,8 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
|
||||||
goto err_free_all;
|
goto err_free_all;
|
||||||
}
|
}
|
||||||
/* At error, ->css_free() callback has to free assigned ID. */
|
/* At error, ->css_free() callback has to free assigned ID. */
|
||||||
if (clone_children(parent) && ss->post_clone)
|
if (test_bit(CGRP_CPUSET_CLONE_CHILDREN, &parent->flags) &&
|
||||||
|
ss->post_clone)
|
||||||
ss->post_clone(cgrp);
|
ss->post_clone(cgrp);
|
||||||
|
|
||||||
if (ss->broken_hierarchy && !ss->warned_broken_hierarchy &&
|
if (ss->broken_hierarchy && !ss->warned_broken_hierarchy &&
|
||||||
|
|
Loading…
Reference in New Issue