aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBen Blum <bblum@google.com>2009-09-23 18:56:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-24 10:20:58 -0400
commit102a775e3647628727ae83a9a6abf0564c3ca7cb (patch)
tree77a3d9717daa0f1dceccc0dcdf821aa12e684e07 /include
parent8f3ff20862cfcb85500a2bb55ee64622bd59fd0c (diff)
cgroups: add a read-only "procs" file similar to "tasks" that shows only unique tgids
struct cgroup used to have a bunch of fields for keeping track of the pidlist for the tasks file. Those are now separated into a new struct cgroup_pidlist, of which two are had, one for procs and one for tasks. The way the seq_file operations are set up is changed so that just the pidlist struct gets passed around as the private data. Interface example: Suppose a multithreaded process has pid 1000 and other threads with ids 1001, 1002, 1003: $ cat tasks 1000 1001 1002 1003 $ cat cgroup.procs 1000 $ Signed-off-by: Ben Blum <bblum@google.com> Signed-off-by: Paul Menage <menage@google.com> Acked-by: Li 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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/cgroup.h22
1 files changed, 14 insertions, 8 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index c833d6f23672..2357733a0a80 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -141,6 +141,17 @@ enum {
141 CGRP_WAIT_ON_RMDIR, 141 CGRP_WAIT_ON_RMDIR,
142}; 142};
143 143
144struct cgroup_pidlist {
145 /* protects the other fields */
146 struct rw_semaphore mutex;
147 /* array of xids */
148 pid_t *list;
149 /* how many elements the above list has */
150 int length;
151 /* how many files are using the current array */
152 int use_count;
153};
154
144struct cgroup { 155struct cgroup {
145 unsigned long flags; /* "unsigned long" so bitops work */ 156 unsigned long flags; /* "unsigned long" so bitops work */
146 157
@@ -179,14 +190,9 @@ struct cgroup {
179 */ 190 */
180 struct list_head release_list; 191 struct list_head release_list;
181 192
182 /* pids_mutex protects the fields below */ 193 /* we will have two separate pidlists, one for pids (the tasks file)
183 struct rw_semaphore pids_mutex; 194 * and one for tgids (the procs file). */
184 /* Array of process ids in the cgroup */ 195 struct cgroup_pidlist tasks, procs;
185 pid_t *tasks_pids;
186 /* How many files are using the current tasks_pids array */
187 int pids_use_count;
188 /* Length of the current tasks_pids array */
189 int pids_length;
190 196
191 /* For RCU-protected deletion */ 197 /* For RCU-protected deletion */
192 struct rcu_head rcu_head; 198 struct rcu_head rcu_head;