aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 13:52:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 13:52:28 -0400
commit68d47a137c3bef754923bccf73fb639c9b0bbd5e (patch)
treee82a527bd978ee96283f03d0df36f47d9aee1e41 /kernel
parentc0e8a139a5bb8add02b4111e9e1957d810d7285e (diff)
parent8c7f6edbda01f1b1a2e60ad61f14fe38023e433b (diff)
Merge branch 'for-3.7-hierarchy' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup hierarchy update from Tejun Heo: "Currently, different cgroup subsystems handle nested cgroups completely differently. There's no consistency among subsystems and the behaviors often are outright broken. People at least seem to agree that the broken hierarhcy behaviors need to be weeded out if any progress is gonna be made on this front and that the fallouts from deprecating the broken behaviors should be acceptable especially given that the current behaviors don't make much sense when nested. This patch makes cgroup emit warning messages if cgroups for subsystems with broken hierarchy behavior are nested to prepare for fixing them in the future. This was put in a separate branch because more related changes were expected (didn't make it this round) and the memory cgroup wanted to pull in this and make changes on top." * 'for-3.7-hierarchy' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: cgroup: mark subsystems with broken hierarchy support and whine if cgroups are nested for them
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup.c12
-rw-r--r--kernel/cgroup_freezer.c8
-rw-r--r--kernel/events/core.c7
3 files changed, 26 insertions, 1 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 485cc1487ea..13774b3b39a 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4076,8 +4076,9 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
4076 set_bit(CGRP_CLONE_CHILDREN, &cgrp->flags); 4076 set_bit(CGRP_CLONE_CHILDREN, &cgrp->flags);
4077 4077
4078 for_each_subsys(root, ss) { 4078 for_each_subsys(root, ss) {
4079 struct cgroup_subsys_state *css = ss->create(cgrp); 4079 struct cgroup_subsys_state *css;
4080 4080
4081 css = ss->create(cgrp);
4081 if (IS_ERR(css)) { 4082 if (IS_ERR(css)) {
4082 err = PTR_ERR(css); 4083 err = PTR_ERR(css);
4083 goto err_destroy; 4084 goto err_destroy;
@@ -4091,6 +4092,15 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
4091 /* At error, ->destroy() callback has to free assigned ID. */ 4092 /* At error, ->destroy() callback has to free assigned ID. */
4092 if (clone_children(parent) && ss->post_clone) 4093 if (clone_children(parent) && ss->post_clone)
4093 ss->post_clone(cgrp); 4094 ss->post_clone(cgrp);
4095
4096 if (ss->broken_hierarchy && !ss->warned_broken_hierarchy &&
4097 parent->parent) {
4098 pr_warning("cgroup: %s (%d) created nested cgroup for controller \"%s\" which has incomplete hierarchy support. Nested cgroups may change behavior in the future.\n",
4099 current->comm, current->pid, ss->name);
4100 if (!strcmp(ss->name, "memory"))
4101 pr_warning("cgroup: \"memory\" requires setting use_hierarchy to 1 on the root.\n");
4102 ss->warned_broken_hierarchy = true;
4103 }
4094 } 4104 }
4095 4105
4096 list_add(&cgrp->sibling, &cgrp->parent->children); 4106 list_add(&cgrp->sibling, &cgrp->parent->children);
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c
index 3649fc6b3ea..b1724ce9898 100644
--- a/kernel/cgroup_freezer.c
+++ b/kernel/cgroup_freezer.c
@@ -373,4 +373,12 @@ struct cgroup_subsys freezer_subsys = {
373 .can_attach = freezer_can_attach, 373 .can_attach = freezer_can_attach,
374 .fork = freezer_fork, 374 .fork = freezer_fork,
375 .base_cftypes = files, 375 .base_cftypes = files,
376
377 /*
378 * freezer subsys doesn't handle hierarchy at all. Frozen state
379 * should be inherited through the hierarchy - if a parent is
380 * frozen, all its children should be frozen. Fix it and remove
381 * the following.
382 */
383 .broken_hierarchy = true,
376}; 384};
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 7b9df353ba1..deec4e50eb3 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7503,5 +7503,12 @@ struct cgroup_subsys perf_subsys = {
7503 .destroy = perf_cgroup_destroy, 7503 .destroy = perf_cgroup_destroy,
7504 .exit = perf_cgroup_exit, 7504 .exit = perf_cgroup_exit,
7505 .attach = perf_cgroup_attach, 7505 .attach = perf_cgroup_attach,
7506
7507 /*
7508 * perf_event cgroup doesn't handle nesting correctly.
7509 * ctx->nr_cgroups adjustments should be propagated through the
7510 * cgroup hierarchy. Fix it and remove the following.
7511 */
7512 .broken_hierarchy = true,
7506}; 7513};
7507#endif /* CONFIG_CGROUP_PERF */ 7514#endif /* CONFIG_CGROUP_PERF */