diff options
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r-- | include/linux/cgroup.h | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 90bba9e62286..b62bb9294d0c 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -141,6 +141,38 @@ enum { | |||
141 | CGRP_WAIT_ON_RMDIR, | 141 | CGRP_WAIT_ON_RMDIR, |
142 | }; | 142 | }; |
143 | 143 | ||
144 | /* which pidlist file are we talking about? */ | ||
145 | enum cgroup_filetype { | ||
146 | CGROUP_FILE_PROCS, | ||
147 | CGROUP_FILE_TASKS, | ||
148 | }; | ||
149 | |||
150 | /* | ||
151 | * A pidlist is a list of pids that virtually represents the contents of one | ||
152 | * of the cgroup files ("procs" or "tasks"). We keep a list of such pidlists, | ||
153 | * a pair (one each for procs, tasks) for each pid namespace that's relevant | ||
154 | * to the cgroup. | ||
155 | */ | ||
156 | struct cgroup_pidlist { | ||
157 | /* | ||
158 | * used to find which pidlist is wanted. doesn't change as long as | ||
159 | * this particular list stays in the list. | ||
160 | */ | ||
161 | struct { enum cgroup_filetype type; struct pid_namespace *ns; } key; | ||
162 | /* array of xids */ | ||
163 | pid_t *list; | ||
164 | /* how many elements the above list has */ | ||
165 | int length; | ||
166 | /* how many files are using the current array */ | ||
167 | int use_count; | ||
168 | /* each of these stored in a list by its cgroup */ | ||
169 | struct list_head links; | ||
170 | /* pointer to the cgroup we belong to, for list removal purposes */ | ||
171 | struct cgroup *owner; | ||
172 | /* protects the other fields */ | ||
173 | struct rw_semaphore mutex; | ||
174 | }; | ||
175 | |||
144 | struct cgroup { | 176 | struct cgroup { |
145 | unsigned long flags; /* "unsigned long" so bitops work */ | 177 | unsigned long flags; /* "unsigned long" so bitops work */ |
146 | 178 | ||
@@ -179,11 +211,12 @@ struct cgroup { | |||
179 | */ | 211 | */ |
180 | struct list_head release_list; | 212 | struct list_head release_list; |
181 | 213 | ||
182 | /* pids_mutex protects pids_list and cached pid arrays. */ | 214 | /* |
183 | struct rw_semaphore pids_mutex; | 215 | * list of pidlists, up to two for each namespace (one for procs, one |
184 | 216 | * for tasks); created on demand. | |
185 | /* Linked list of struct cgroup_pids */ | 217 | */ |
186 | struct list_head pids_list; | 218 | struct list_head pidlists; |
219 | struct mutex pidlist_mutex; | ||
187 | 220 | ||
188 | /* For RCU-protected deletion */ | 221 | /* For RCU-protected deletion */ |
189 | struct rcu_head rcu_head; | 222 | struct rcu_head rcu_head; |
@@ -227,6 +260,9 @@ struct css_set { | |||
227 | * during subsystem registration (at boot time). | 260 | * during subsystem registration (at boot time). |
228 | */ | 261 | */ |
229 | struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; | 262 | struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; |
263 | |||
264 | /* For RCU-protected deletion */ | ||
265 | struct rcu_head rcu_head; | ||
230 | }; | 266 | }; |
231 | 267 | ||
232 | /* | 268 | /* |
@@ -389,10 +425,11 @@ struct cgroup_subsys { | |||
389 | struct cgroup *cgrp); | 425 | struct cgroup *cgrp); |
390 | int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); | 426 | int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); |
391 | void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); | 427 | void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); |
392 | int (*can_attach)(struct cgroup_subsys *ss, | 428 | int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, |
393 | struct cgroup *cgrp, struct task_struct *tsk); | 429 | struct task_struct *tsk, bool threadgroup); |
394 | void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, | 430 | void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, |
395 | struct cgroup *old_cgrp, struct task_struct *tsk); | 431 | struct cgroup *old_cgrp, struct task_struct *tsk, |
432 | bool threadgroup); | ||
396 | void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); | 433 | void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); |
397 | void (*exit)(struct cgroup_subsys *ss, struct task_struct *task); | 434 | void (*exit)(struct cgroup_subsys *ss, struct task_struct *task); |
398 | int (*populate)(struct cgroup_subsys *ss, | 435 | int (*populate)(struct cgroup_subsys *ss, |