aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-04-12 13:29:04 -0400
committerTejun Heo <tj@kernel.org>2013-04-12 13:29:04 -0400
commit26d5bbe5ba2073fc7ef9e69a55543b2376f5bad0 (patch)
treed4dcfdec4d3046bb3cee35864264669d44a3a3dc
parentef824fa129b7579f56b92d466ecda2e378879806 (diff)
Revert "cgroup: remove bind() method from cgroup_subsys."
This reverts commit 84cfb6ab484b442d5115eb3baf9db7d74a3ea626. There are scheduled changes which make use of the removed callback. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Rami Rosen <ramirose@gmail.com> Cc: Li Zefan <lizefan@huawei.com>
-rw-r--r--Documentation/cgroups/cgroups.txt20
-rw-r--r--include/linux/cgroup.h2
-rw-r--r--kernel/cgroup.c4
3 files changed, 21 insertions, 5 deletions
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt
index 2b51e12ce178..638bf17ff869 100644
--- a/Documentation/cgroups/cgroups.txt
+++ b/Documentation/cgroups/cgroups.txt
@@ -211,9 +211,10 @@ matches, and any of the requested subsystems are in use in an existing
211hierarchy, the mount will fail with -EBUSY. Otherwise, a new hierarchy 211hierarchy, the mount will fail with -EBUSY. Otherwise, a new hierarchy
212is activated, associated with the requested subsystems. 212is activated, associated with the requested subsystems.
213 213
214It's not possible to bind a new subsystem to an active cgroup 214It's not currently possible to bind a new subsystem to an active
215hierarchy, or to unbind a subsystem from an active cgroup 215cgroup hierarchy, or to unbind a subsystem from an active cgroup
216hierarchy. 216hierarchy. This may be possible in future, but is fraught with nasty
217error-recovery issues.
217 218
218When a cgroup filesystem is unmounted, if there are any 219When a cgroup filesystem is unmounted, if there are any
219child cgroups created below the top-level cgroup, that hierarchy 220child cgroups created below the top-level cgroup, that hierarchy
@@ -381,8 +382,10 @@ To Specify a hierarchy's release_agent:
381 382
382Note that specifying 'release_agent' more than once will return failure. 383Note that specifying 'release_agent' more than once will return failure.
383 384
384Note that changing the set of subsystems is only supported when the 385Note that changing the set of subsystems is currently only supported
385hierarchy consists of a single (root) cgroup. 386when the hierarchy consists of a single (root) cgroup. Supporting
387the ability to arbitrarily bind/unbind subsystems from an existing
388cgroup hierarchy is intended to be implemented in the future.
386 389
387Then under /sys/fs/cgroup/rg1 you can find a tree that corresponds to the 390Then under /sys/fs/cgroup/rg1 you can find a tree that corresponds to the
388tree of the cgroups in the system. For instance, /sys/fs/cgroup/rg1 391tree of the cgroups in the system. For instance, /sys/fs/cgroup/rg1
@@ -640,6 +643,13 @@ void exit(struct task_struct *task)
640 643
641Called during task exit. 644Called during task exit.
642 645
646void bind(struct cgroup *root)
647(cgroup_mutex held by caller)
648
649Called when a cgroup subsystem is rebound to a different hierarchy
650and root cgroup. Currently this will only involve movement between
651the default hierarchy (which never has sub-cgroups) and a hierarchy
652that is being created/destroyed (and hence has no sub-cgroups).
643 653
6444. Extended attribute usage 6544. Extended attribute usage
645=========================== 655===========================
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index a2b9d4b13369..45aee0fc6b98 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -484,6 +484,8 @@ struct cgroup_subsys {
484 void (*fork)(struct task_struct *task); 484 void (*fork)(struct task_struct *task);
485 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp, 485 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp,
486 struct task_struct *task); 486 struct task_struct *task);
487 void (*bind)(struct cgroup *root);
488
487 int subsys_id; 489 int subsys_id;
488 int active; 490 int active;
489 int disabled; 491 int disabled;
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 7bf3ce09c50c..678a22c75fdb 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1091,12 +1091,16 @@ static int rebind_subsystems(struct cgroupfs_root *root,
1091 cgrp->subsys[i]->cgroup = cgrp; 1091 cgrp->subsys[i]->cgroup = cgrp;
1092 list_move(&ss->sibling, &root->subsys_list); 1092 list_move(&ss->sibling, &root->subsys_list);
1093 ss->root = root; 1093 ss->root = root;
1094 if (ss->bind)
1095 ss->bind(cgrp);
1094 /* refcount was already taken, and we're keeping it */ 1096 /* refcount was already taken, and we're keeping it */
1095 } else if (bit & removed_mask) { 1097 } else if (bit & removed_mask) {
1096 /* We're removing this subsystem */ 1098 /* We're removing this subsystem */
1097 BUG_ON(ss == NULL); 1099 BUG_ON(ss == NULL);
1098 BUG_ON(cgrp->subsys[i] != dummytop->subsys[i]); 1100 BUG_ON(cgrp->subsys[i] != dummytop->subsys[i]);
1099 BUG_ON(cgrp->subsys[i]->cgroup != cgrp); 1101 BUG_ON(cgrp->subsys[i]->cgroup != cgrp);
1102 if (ss->bind)
1103 ss->bind(dummytop);
1100 dummytop->subsys[i]->cgroup = dummytop; 1104 dummytop->subsys[i]->cgroup = dummytop;
1101 cgrp->subsys[i] = NULL; 1105 cgrp->subsys[i] = NULL;
1102 subsys[i]->root = &rootnode; 1106 subsys[i]->root = &rootnode;