aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/cgroups/cgroups.txt8
-rw-r--r--include/linux/cgroup.h6
-rw-r--r--kernel/cgroup.c28
3 files changed, 19 insertions, 23 deletions
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt
index b06eea217403..24cdf76bd20c 100644
--- a/Documentation/cgroups/cgroups.txt
+++ b/Documentation/cgroups/cgroups.txt
@@ -299,11 +299,9 @@ a cgroup hierarchy's release_agent path is empty.
2991.5 What does clone_children do ? 2991.5 What does clone_children do ?
300--------------------------------- 300---------------------------------
301 301
302If the clone_children flag is enabled (1) in a cgroup, then all 302This flag only affects the cpuset controller. If the clone_children
303cgroups created beneath will call the post_clone callbacks for each 303flag is enabled (1) in a cgroup, a new cpuset cgroup will copy its
304subsystem of the newly created cgroup. Usually when this callback is 304configuration from the parent during initialization.
305implemented for a subsystem, it copies the values of the parent
306subsystem, this is the case for the cpuset.
307 305
3081.6 How do I use cgroups ? 3061.6 How do I use cgroups ?
309-------------------------- 307--------------------------
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 7a2189ca8327..d2f82979f6c1 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -143,9 +143,11 @@ enum {
143 /* Control Group requires release notifications to userspace */ 143 /* Control Group requires release notifications to userspace */
144 CGRP_NOTIFY_ON_RELEASE, 144 CGRP_NOTIFY_ON_RELEASE,
145 /* 145 /*
146 * Clone cgroup values when creating a new child cgroup 146 * Clone the parent's configuration when creating a new child
147 * cpuset cgroup. For historical reasons, this option can be
148 * specified at mount time and thus is implemented here.
147 */ 149 */
148 CGRP_CLONE_CHILDREN, 150 CGRP_CPUSET_CLONE_CHILDREN,
149}; 151};
150 152
151struct cgroup { 153struct cgroup {
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index d35463bab487..2895880e6800 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -296,11 +296,6 @@ static int notify_on_release(const struct cgroup *cgrp)
296 return test_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags); 296 return test_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
297} 297}
298 298
299static int clone_children(const struct cgroup *cgrp)
300{
301 return test_bit(CGRP_CLONE_CHILDREN, &cgrp->flags);
302}
303
304/* 299/*
305 * for_each_subsys() allows you to iterate on each subsystem attached to 300 * for_each_subsys() allows you to iterate on each subsystem attached to
306 * an active hierarchy 301 * an active hierarchy
@@ -1101,7 +1096,7 @@ static int cgroup_show_options(struct seq_file *seq, struct dentry *dentry)
1101 seq_puts(seq, ",xattr"); 1096 seq_puts(seq, ",xattr");
1102 if (strlen(root->release_agent_path)) 1097 if (strlen(root->release_agent_path))
1103 seq_printf(seq, ",release_agent=%s", root->release_agent_path); 1098 seq_printf(seq, ",release_agent=%s", root->release_agent_path);
1104 if (clone_children(&root->top_cgroup)) 1099 if (test_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->top_cgroup.flags))
1105 seq_puts(seq, ",clone_children"); 1100 seq_puts(seq, ",clone_children");
1106 if (strlen(root->name)) 1101 if (strlen(root->name))
1107 seq_printf(seq, ",name=%s", root->name); 1102 seq_printf(seq, ",name=%s", root->name);
@@ -1113,7 +1108,7 @@ struct cgroup_sb_opts {
1113 unsigned long subsys_mask; 1108 unsigned long subsys_mask;
1114 unsigned long flags; 1109 unsigned long flags;
1115 char *release_agent; 1110 char *release_agent;
1116 bool clone_children; 1111 bool cpuset_clone_children;
1117 char *name; 1112 char *name;
1118 /* User explicitly requested empty subsystem */ 1113 /* User explicitly requested empty subsystem */
1119 bool none; 1114 bool none;
@@ -1164,7 +1159,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
1164 continue; 1159 continue;
1165 } 1160 }
1166 if (!strcmp(token, "clone_children")) { 1161 if (!strcmp(token, "clone_children")) {
1167 opts->clone_children = true; 1162 opts->cpuset_clone_children = true;
1168 continue; 1163 continue;
1169 } 1164 }
1170 if (!strcmp(token, "xattr")) { 1165 if (!strcmp(token, "xattr")) {
@@ -1474,8 +1469,8 @@ static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts)
1474 strcpy(root->release_agent_path, opts->release_agent); 1469 strcpy(root->release_agent_path, opts->release_agent);
1475 if (opts->name) 1470 if (opts->name)
1476 strcpy(root->name, opts->name); 1471 strcpy(root->name, opts->name);
1477 if (opts->clone_children) 1472 if (opts->cpuset_clone_children)
1478 set_bit(CGRP_CLONE_CHILDREN, &root->top_cgroup.flags); 1473 set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->top_cgroup.flags);
1479 return root; 1474 return root;
1480} 1475}
1481 1476
@@ -3905,7 +3900,7 @@ fail:
3905static u64 cgroup_clone_children_read(struct cgroup *cgrp, 3900static u64 cgroup_clone_children_read(struct cgroup *cgrp,
3906 struct cftype *cft) 3901 struct cftype *cft)
3907{ 3902{
3908 return clone_children(cgrp); 3903 return test_bit(CGRP_CPUSET_CLONE_CHILDREN, &cgrp->flags);
3909} 3904}
3910 3905
3911static int cgroup_clone_children_write(struct cgroup *cgrp, 3906static int cgroup_clone_children_write(struct cgroup *cgrp,
@@ -3913,9 +3908,9 @@ static int cgroup_clone_children_write(struct cgroup *cgrp,
3913 u64 val) 3908 u64 val)
3914{ 3909{
3915 if (val) 3910 if (val)
3916 set_bit(CGRP_CLONE_CHILDREN, &cgrp->flags); 3911 set_bit(CGRP_CPUSET_CLONE_CHILDREN, &cgrp->flags);
3917 else 3912 else
3918 clear_bit(CGRP_CLONE_CHILDREN, &cgrp->flags); 3913 clear_bit(CGRP_CPUSET_CLONE_CHILDREN, &cgrp->flags);
3919 return 0; 3914 return 0;
3920} 3915}
3921 3916
@@ -4130,8 +4125,8 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
4130 if (notify_on_release(parent)) 4125 if (notify_on_release(parent))
4131 set_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags); 4126 set_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
4132 4127
4133 if (clone_children(parent)) 4128 if (test_bit(CGRP_CPUSET_CLONE_CHILDREN, &parent->flags))
4134 set_bit(CGRP_CLONE_CHILDREN, &cgrp->flags); 4129 set_bit(CGRP_CPUSET_CLONE_CHILDREN, &cgrp->flags);
4135 4130
4136 for_each_subsys(root, ss) { 4131 for_each_subsys(root, ss) {
4137 struct cgroup_subsys_state *css; 4132 struct cgroup_subsys_state *css;
@@ -4148,7 +4143,8 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
4148 goto err_free_all; 4143 goto err_free_all;
4149 } 4144 }
4150 /* At error, ->css_free() callback has to free assigned ID. */ 4145 /* At error, ->css_free() callback has to free assigned ID. */
4151 if (clone_children(parent) && ss->post_clone) 4146 if (test_bit(CGRP_CPUSET_CLONE_CHILDREN, &parent->flags) &&
4147 ss->post_clone)
4152 ss->post_clone(cgrp); 4148 ss->post_clone(cgrp);
4153 4149
4154 if (ss->broken_hierarchy && !ss->warned_broken_hierarchy && 4150 if (ss->broken_hierarchy && !ss->warned_broken_hierarchy &&