Commit aba7244f authored by Ben Blum's avatar Ben Blum Committed by James Toy

Add functionality that enables users to move all threads in a threadgroup

at once to a cgroup by writing the tgid to the 'cgroup.procs' file.  This
current implementation makes use of a per-threadgroup rwsem that's taken
for reading in the fork() path to prevent newly forking threads within the
threadgroup from "escaping" while the move is in progress.

Cgroups subsystems that need to perform per-thread actions in their
"attach" callback are (currently) responsible for doing their own
synchronization, since this occurs outside of the critical section that
locks against cloning within a thread group.
Signed-off-by: default avatarBen Blum <bblum@google.com>
Signed-off-by: default avatarPaul Menage <menage@google.com>
Acked-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent bd3246a9
......@@ -9,6 +9,7 @@ Portions Copyright (C) 2004 BULL SA.
Portions Copyright (c) 2004-2006 Silicon Graphics, Inc.
Modified by Paul Jackson <pj@sgi.com>
Modified by Christoph Lameter <clameter@sgi.com>
Modified by Ben Blum <bblum@google.com>
CONTENTS:
=========
......@@ -228,6 +229,7 @@ Each cgroup is represented by a directory in the cgroup file system
containing the following files describing that cgroup:
- tasks: list of tasks (by pid) attached to that cgroup
- cgroup.procs: list of unique tgids in the cgroup
- notify_on_release flag: run the release agent on exit?
- release_agent: the path to use for release notifications (this file
exists in the top cgroup only)
......@@ -374,7 +376,7 @@ Now you want to do something with this cgroup.
In this directory you can find several files:
# ls
notify_on_release tasks
cgroup.procs notify_on_release tasks
(plus whatever files added by the attached subsystems)
Now attach your shell to this cgroup:
......@@ -408,6 +410,15 @@ You can attach the current shell task by echoing 0:
# echo 0 > tasks
The cgroup.procs file is useful for managing all tasks in a threadgroup at
once. It works the same way as the tasks file, but moves all tasks in the
threadgroup with the specified tgid.
Writing the pid of a task that's not the threadgroup leader (i.e., a pid
that isn't a tgid) is treated as invalid. Writing a '0' to cgroup.procs will
attach the writing task and all tasks in its threadgroup, but is invalid if
the writing task is not the leader of the threadgroup.
2.3 Mounting hierarchies by name
--------------------------------
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment