diff options
author | Ben Blum <bblum@google.com> | 2009-09-23 18:56:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-24 10:20:58 -0400 |
commit | be367d09927023d081f9199665c8500f69f14d22 (patch) | |
tree | f0c5b9da037506da3c5890cf11b51b39a7d3c427 /Documentation | |
parent | c378369d8b4fa516ff2b1e79c3eded4e0e955ebb (diff) |
cgroups: let ss->can_attach and ss->attach do whole threadgroups at a time
Alter the ss->can_attach and ss->attach functions to be able to deal with
a whole threadgroup at a time, for use in cgroup_attach_proc. (This is a
pre-patch to cgroup-procs-writable.patch.)
Currently, new mode of the attach function can only tell the subsystem
about the old cgroup of the threadgroup leader. No subsystem currently
needs that information for each thread that's being moved, but if one were
to be added (for example, one that counts tasks within a group) this bit
would need to be reworked a bit to tell the subsystem the right
information.
[hidave.darkstar@gmail.com: fix build]
Signed-off-by: Ben Blum <bblum@google.com>
Signed-off-by: Paul Menage <menage@google.com>
Acked-by: Li Zefan <lizf@cn.fujitsu.com>
Reviewed-by: Matt Helsley <matthltc@us.ibm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Dave Young <hidave.darkstar@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/cgroups/cgroups.txt | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt index 4bccfc19196b..455d4e6d346d 100644 --- a/Documentation/cgroups/cgroups.txt +++ b/Documentation/cgroups/cgroups.txt | |||
@@ -521,7 +521,7 @@ rmdir() will fail with it. From this behavior, pre_destroy() can be | |||
521 | called multiple times against a cgroup. | 521 | called multiple times against a cgroup. |
522 | 522 | ||
523 | int can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, | 523 | int can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, |
524 | struct task_struct *task) | 524 | struct task_struct *task, bool threadgroup) |
525 | (cgroup_mutex held by caller) | 525 | (cgroup_mutex held by caller) |
526 | 526 | ||
527 | Called prior to moving a task into a cgroup; if the subsystem | 527 | Called prior to moving a task into a cgroup; if the subsystem |
@@ -529,14 +529,20 @@ returns an error, this will abort the attach operation. If a NULL | |||
529 | task is passed, then a successful result indicates that *any* | 529 | task is passed, then a successful result indicates that *any* |
530 | unspecified task can be moved into the cgroup. Note that this isn't | 530 | unspecified task can be moved into the cgroup. Note that this isn't |
531 | called on a fork. If this method returns 0 (success) then this should | 531 | called on a fork. If this method returns 0 (success) then this should |
532 | remain valid while the caller holds cgroup_mutex. | 532 | remain valid while the caller holds cgroup_mutex. If threadgroup is |
533 | true, then a successful result indicates that all threads in the given | ||
534 | thread's threadgroup can be moved together. | ||
533 | 535 | ||
534 | void attach(struct cgroup_subsys *ss, struct cgroup *cgrp, | 536 | void attach(struct cgroup_subsys *ss, struct cgroup *cgrp, |
535 | struct cgroup *old_cgrp, struct task_struct *task) | 537 | struct cgroup *old_cgrp, struct task_struct *task, |
538 | bool threadgroup) | ||
536 | (cgroup_mutex held by caller) | 539 | (cgroup_mutex held by caller) |
537 | 540 | ||
538 | Called after the task has been attached to the cgroup, to allow any | 541 | Called after the task has been attached to the cgroup, to allow any |
539 | post-attachment activity that requires memory allocations or blocking. | 542 | post-attachment activity that requires memory allocations or blocking. |
543 | If threadgroup is true, the subsystem should take care of all threads | ||
544 | in the specified thread's threadgroup. Currently does not support any | ||
545 | subsystem that might need the old_cgrp for every thread in the group. | ||
540 | 546 | ||
541 | void fork(struct cgroup_subsy *ss, struct task_struct *task) | 547 | void fork(struct cgroup_subsy *ss, struct task_struct *task) |
542 | 548 | ||