diff options
author | Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> | 2010-03-10 18:22:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-12 18:52:35 -0500 |
commit | 2468c7234b366eeb799ee0648cb58f9cba394a54 (patch) | |
tree | 050d7ea224b975eb71b05bf472f14f4c7bb13670 /Documentation/cgroups | |
parent | 5ce9f07bf1bed9a1f9886373ad0b149294f84c25 (diff) |
cgroup: introduce cancel_attach()
Add cancel_attach() operation to struct cgroup_subsys. cancel_attach()
can be used when can_attach() operation prepares something for the subsys,
but we should rollback what can_attach() operation has prepared if attach
task fails after we've succeeded in can_attach().
Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: Li Zefan <lizf@cn.fujitsu.com>
Reviewed-by: Paul Menage <menage@google.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/cgroups')
-rw-r--r-- | Documentation/cgroups/cgroups.txt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt index 0b33bfe7dde9..d45082653e3d 100644 --- a/Documentation/cgroups/cgroups.txt +++ b/Documentation/cgroups/cgroups.txt | |||
@@ -536,10 +536,21 @@ returns an error, this will abort the attach operation. If a NULL | |||
536 | task is passed, then a successful result indicates that *any* | 536 | task is passed, then a successful result indicates that *any* |
537 | unspecified task can be moved into the cgroup. Note that this isn't | 537 | unspecified task can be moved into the cgroup. Note that this isn't |
538 | called on a fork. If this method returns 0 (success) then this should | 538 | called on a fork. If this method returns 0 (success) then this should |
539 | remain valid while the caller holds cgroup_mutex. If threadgroup is | 539 | remain valid while the caller holds cgroup_mutex and it is ensured that either |
540 | attach() or cancel_attach() will be called in future. If threadgroup is | ||
540 | true, then a successful result indicates that all threads in the given | 541 | true, then a successful result indicates that all threads in the given |
541 | thread's threadgroup can be moved together. | 542 | thread's threadgroup can be moved together. |
542 | 543 | ||
544 | void cancel_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, | ||
545 | struct task_struct *task, bool threadgroup) | ||
546 | (cgroup_mutex held by caller) | ||
547 | |||
548 | Called when a task attach operation has failed after can_attach() has succeeded. | ||
549 | A subsystem whose can_attach() has some side-effects should provide this | ||
550 | function, so that the subsytem can implement a rollback. If not, not necessary. | ||
551 | This will be called only about subsystems whose can_attach() operation have | ||
552 | succeeded. | ||
553 | |||
543 | void attach(struct cgroup_subsys *ss, struct cgroup *cgrp, | 554 | void attach(struct cgroup_subsys *ss, struct cgroup *cgrp, |
544 | struct cgroup *old_cgrp, struct task_struct *task, | 555 | struct cgroup *old_cgrp, struct task_struct *task, |
545 | bool threadgroup) | 556 | bool threadgroup) |