diff options
author | Ben Blum <bblum@andrew.cmu.edu> | 2011-05-26 19:25:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 20:12:34 -0400 |
commit | 4714d1d32d97239fb5ae3e10521d3f133a899b66 (patch) | |
tree | fb50707cefc386bf4e87cac9661a38dcfe3192df /include/linux/init_task.h | |
parent | dcb3a08e69629ea65a3e9647da730bfaf670497d (diff) |
cgroups: read-write lock CLONE_THREAD forking per threadgroup
Adds functionality to read/write lock CLONE_THREAD fork()ing per-threadgroup
Add an rwsem that lives in a threadgroup's signal_struct that's taken for
reading in the fork path, under CONFIG_CGROUPS. If another part of the
kernel later wants to use such a locking mechanism, the CONFIG_CGROUPS
ifdefs should be changed to a higher-up flag that CGROUPS and the other
system would both depend on.
This is a pre-patch for cgroup-procs-write.patch.
Signed-off-by: Ben Blum <bblum@andrew.cmu.edu>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Matt Helsley <matthltc@us.ibm.com>
Reviewed-by: Paul Menage <menage@google.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/init_task.h')
-rw-r--r-- | include/linux/init_task.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index bafc58c00fc3..580f70c02391 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -22,6 +22,14 @@ | |||
22 | extern struct files_struct init_files; | 22 | extern struct files_struct init_files; |
23 | extern struct fs_struct init_fs; | 23 | extern struct fs_struct init_fs; |
24 | 24 | ||
25 | #ifdef CONFIG_CGROUPS | ||
26 | #define INIT_THREADGROUP_FORK_LOCK(sig) \ | ||
27 | .threadgroup_fork_lock = \ | ||
28 | __RWSEM_INITIALIZER(sig.threadgroup_fork_lock), | ||
29 | #else | ||
30 | #define INIT_THREADGROUP_FORK_LOCK(sig) | ||
31 | #endif | ||
32 | |||
25 | #define INIT_SIGNALS(sig) { \ | 33 | #define INIT_SIGNALS(sig) { \ |
26 | .nr_threads = 1, \ | 34 | .nr_threads = 1, \ |
27 | .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ | 35 | .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ |
@@ -38,6 +46,7 @@ extern struct fs_struct init_fs; | |||
38 | }, \ | 46 | }, \ |
39 | .cred_guard_mutex = \ | 47 | .cred_guard_mutex = \ |
40 | __MUTEX_INITIALIZER(sig.cred_guard_mutex), \ | 48 | __MUTEX_INITIALIZER(sig.cred_guard_mutex), \ |
49 | INIT_THREADGROUP_FORK_LOCK(sig) \ | ||
41 | } | 50 | } |
42 | 51 | ||
43 | extern struct nsproxy init_nsproxy; | 52 | extern struct nsproxy init_nsproxy; |