diff options
Diffstat (limited to 'Documentation/cgroups')
-rw-r--r-- | Documentation/cgroups/cgroups.txt | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt index 9c452ef2328c..8a2f302327fa 100644 --- a/Documentation/cgroups/cgroups.txt +++ b/Documentation/cgroups/cgroups.txt | |||
@@ -594,15 +594,25 @@ rmdir() will fail with it. From this behavior, pre_destroy() can be | |||
594 | called multiple times against a cgroup. | 594 | called multiple times against a cgroup. |
595 | 595 | ||
596 | int can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, | 596 | int can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, |
597 | struct task_struct *task) | 597 | struct cgroup_taskset *tset) |
598 | (cgroup_mutex held by caller) | 598 | (cgroup_mutex held by caller) |
599 | 599 | ||
600 | Called prior to moving a task into a cgroup; if the subsystem | 600 | Called prior to moving one or more tasks into a cgroup; if the |
601 | returns an error, this will abort the attach operation. If a NULL | 601 | subsystem returns an error, this will abort the attach operation. |
602 | task is passed, then a successful result indicates that *any* | 602 | @tset contains the tasks to be attached and is guaranteed to have at |
603 | unspecified task can be moved into the cgroup. Note that this isn't | 603 | least one task in it. |
604 | called on a fork. If this method returns 0 (success) then this should | 604 | |
605 | remain valid while the caller holds cgroup_mutex and it is ensured that either | 605 | If there are multiple tasks in the taskset, then: |
606 | - it's guaranteed that all are from the same thread group | ||
607 | - @tset contains all tasks from the thread group whether or not | ||
608 | they're switching cgroups | ||
609 | - the first task is the leader | ||
610 | |||
611 | Each @tset entry also contains the task's old cgroup and tasks which | ||
612 | aren't switching cgroup can be skipped easily using the | ||
613 | cgroup_taskset_for_each() iterator. Note that this isn't called on a | ||
614 | fork. If this method returns 0 (success) then this should remain valid | ||
615 | while the caller holds cgroup_mutex and it is ensured that either | ||
606 | attach() or cancel_attach() will be called in future. | 616 | attach() or cancel_attach() will be called in future. |
607 | 617 | ||
608 | int can_attach_task(struct cgroup *cgrp, struct task_struct *tsk); | 618 | int can_attach_task(struct cgroup *cgrp, struct task_struct *tsk); |
@@ -613,14 +623,14 @@ attached (possibly many when using cgroup_attach_proc). Called after | |||
613 | can_attach. | 623 | can_attach. |
614 | 624 | ||
615 | void cancel_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, | 625 | void cancel_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, |
616 | struct task_struct *task, bool threadgroup) | 626 | struct cgroup_taskset *tset) |
617 | (cgroup_mutex held by caller) | 627 | (cgroup_mutex held by caller) |
618 | 628 | ||
619 | Called when a task attach operation has failed after can_attach() has succeeded. | 629 | Called when a task attach operation has failed after can_attach() has succeeded. |
620 | A subsystem whose can_attach() has some side-effects should provide this | 630 | A subsystem whose can_attach() has some side-effects should provide this |
621 | function, so that the subsystem can implement a rollback. If not, not necessary. | 631 | function, so that the subsystem can implement a rollback. If not, not necessary. |
622 | This will be called only about subsystems whose can_attach() operation have | 632 | This will be called only about subsystems whose can_attach() operation have |
623 | succeeded. | 633 | succeeded. The parameters are identical to can_attach(). |
624 | 634 | ||
625 | void pre_attach(struct cgroup *cgrp); | 635 | void pre_attach(struct cgroup *cgrp); |
626 | (cgroup_mutex held by caller) | 636 | (cgroup_mutex held by caller) |
@@ -629,11 +639,12 @@ For any non-per-thread attachment work that needs to happen before | |||
629 | attach_task. Needed by cpuset. | 639 | attach_task. Needed by cpuset. |
630 | 640 | ||
631 | void attach(struct cgroup_subsys *ss, struct cgroup *cgrp, | 641 | void attach(struct cgroup_subsys *ss, struct cgroup *cgrp, |
632 | struct cgroup *old_cgrp, struct task_struct *task) | 642 | struct cgroup_taskset *tset) |
633 | (cgroup_mutex held by caller) | 643 | (cgroup_mutex held by caller) |
634 | 644 | ||
635 | Called after the task has been attached to the cgroup, to allow any | 645 | Called after the task has been attached to the cgroup, to allow any |
636 | post-attachment activity that requires memory allocations or blocking. | 646 | post-attachment activity that requires memory allocations or blocking. |
647 | The parameters are identical to can_attach(). | ||
637 | 648 | ||
638 | void attach_task(struct cgroup *cgrp, struct task_struct *tsk); | 649 | void attach_task(struct cgroup *cgrp, struct task_struct *tsk); |
639 | (cgroup_mutex held by caller) | 650 | (cgroup_mutex held by caller) |