diff options
author | Jiri Kosina <jkosina@suse.cz> | 2008-05-06 10:57:55 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2008-05-06 10:57:55 -0400 |
commit | 7022b15e2a9f878fd5184586064c63352c3dd225 (patch) | |
tree | 5365c2f5bc82ae1946636ee8d5cd5d3b7e804f1b /include/linux/cgroup.h | |
parent | aaad2b0c757f3e6e02552cb0bdcd91a5ec0d6305 (diff) | |
parent | a15306365a16380f3bafee9e181ba01231d4acd7 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r-- | include/linux/cgroup.h | 80 |
1 files changed, 73 insertions, 7 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index a6a6035a4e1e..e155aa78d859 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -88,6 +88,17 @@ static inline void css_put(struct cgroup_subsys_state *css) | |||
88 | __css_put(css); | 88 | __css_put(css); |
89 | } | 89 | } |
90 | 90 | ||
91 | /* bits in struct cgroup flags field */ | ||
92 | enum { | ||
93 | /* Control Group is dead */ | ||
94 | CGRP_REMOVED, | ||
95 | /* Control Group has previously had a child cgroup or a task, | ||
96 | * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */ | ||
97 | CGRP_RELEASABLE, | ||
98 | /* Control Group requires release notifications to userspace */ | ||
99 | CGRP_NOTIFY_ON_RELEASE, | ||
100 | }; | ||
101 | |||
91 | struct cgroup { | 102 | struct cgroup { |
92 | unsigned long flags; /* "unsigned long" so bitops work */ | 103 | unsigned long flags; /* "unsigned long" so bitops work */ |
93 | 104 | ||
@@ -139,10 +150,10 @@ struct css_set { | |||
139 | struct kref ref; | 150 | struct kref ref; |
140 | 151 | ||
141 | /* | 152 | /* |
142 | * List running through all cgroup groups. Protected by | 153 | * List running through all cgroup groups in the same hash |
143 | * css_set_lock | 154 | * slot. Protected by css_set_lock |
144 | */ | 155 | */ |
145 | struct list_head list; | 156 | struct hlist_node hlist; |
146 | 157 | ||
147 | /* | 158 | /* |
148 | * List running through all tasks using this cgroup | 159 | * List running through all tasks using this cgroup |
@@ -163,7 +174,16 @@ struct css_set { | |||
163 | * during subsystem registration (at boot time). | 174 | * during subsystem registration (at boot time). |
164 | */ | 175 | */ |
165 | struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; | 176 | struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; |
177 | }; | ||
178 | |||
179 | /* | ||
180 | * cgroup_map_cb is an abstract callback API for reporting map-valued | ||
181 | * control files | ||
182 | */ | ||
166 | 183 | ||
184 | struct cgroup_map_cb { | ||
185 | int (*fill)(struct cgroup_map_cb *cb, const char *key, u64 value); | ||
186 | void *state; | ||
167 | }; | 187 | }; |
168 | 188 | ||
169 | /* struct cftype: | 189 | /* struct cftype: |
@@ -190,20 +210,51 @@ struct cftype { | |||
190 | struct file *file, | 210 | struct file *file, |
191 | char __user *buf, size_t nbytes, loff_t *ppos); | 211 | char __user *buf, size_t nbytes, loff_t *ppos); |
192 | /* | 212 | /* |
193 | * read_uint() is a shortcut for the common case of returning a | 213 | * read_u64() is a shortcut for the common case of returning a |
194 | * single integer. Use it in place of read() | 214 | * single integer. Use it in place of read() |
195 | */ | 215 | */ |
196 | u64 (*read_uint) (struct cgroup *cgrp, struct cftype *cft); | 216 | u64 (*read_u64) (struct cgroup *cgrp, struct cftype *cft); |
217 | /* | ||
218 | * read_s64() is a signed version of read_u64() | ||
219 | */ | ||
220 | s64 (*read_s64) (struct cgroup *cgrp, struct cftype *cft); | ||
221 | /* | ||
222 | * read_map() is used for defining a map of key/value | ||
223 | * pairs. It should call cb->fill(cb, key, value) for each | ||
224 | * entry. The key/value pairs (and their ordering) should not | ||
225 | * change between reboots. | ||
226 | */ | ||
227 | int (*read_map) (struct cgroup *cont, struct cftype *cft, | ||
228 | struct cgroup_map_cb *cb); | ||
229 | /* | ||
230 | * read_seq_string() is used for outputting a simple sequence | ||
231 | * using seqfile. | ||
232 | */ | ||
233 | int (*read_seq_string) (struct cgroup *cont, struct cftype *cft, | ||
234 | struct seq_file *m); | ||
235 | |||
197 | ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft, | 236 | ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft, |
198 | struct file *file, | 237 | struct file *file, |
199 | const char __user *buf, size_t nbytes, loff_t *ppos); | 238 | const char __user *buf, size_t nbytes, loff_t *ppos); |
200 | 239 | ||
201 | /* | 240 | /* |
202 | * write_uint() is a shortcut for the common case of accepting | 241 | * write_u64() is a shortcut for the common case of accepting |
203 | * a single integer (as parsed by simple_strtoull) from | 242 | * a single integer (as parsed by simple_strtoull) from |
204 | * userspace. Use in place of write(); return 0 or error. | 243 | * userspace. Use in place of write(); return 0 or error. |
205 | */ | 244 | */ |
206 | int (*write_uint) (struct cgroup *cgrp, struct cftype *cft, u64 val); | 245 | int (*write_u64) (struct cgroup *cgrp, struct cftype *cft, u64 val); |
246 | /* | ||
247 | * write_s64() is a signed version of write_u64() | ||
248 | */ | ||
249 | int (*write_s64) (struct cgroup *cgrp, struct cftype *cft, s64 val); | ||
250 | |||
251 | /* | ||
252 | * trigger() callback can be used to get some kick from the | ||
253 | * userspace, when the actual string written is not important | ||
254 | * at all. The private field can be used to determine the | ||
255 | * kick type for multiplexing. | ||
256 | */ | ||
257 | int (*trigger)(struct cgroup *cgrp, unsigned int event); | ||
207 | 258 | ||
208 | int (*release) (struct inode *inode, struct file *file); | 259 | int (*release) (struct inode *inode, struct file *file); |
209 | }; | 260 | }; |
@@ -254,6 +305,12 @@ struct cgroup_subsys { | |||
254 | struct cgroup *cgrp); | 305 | struct cgroup *cgrp); |
255 | void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); | 306 | void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); |
256 | void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); | 307 | void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); |
308 | /* | ||
309 | * This routine is called with the task_lock of mm->owner held | ||
310 | */ | ||
311 | void (*mm_owner_changed)(struct cgroup_subsys *ss, | ||
312 | struct cgroup *old, | ||
313 | struct cgroup *new); | ||
257 | int subsys_id; | 314 | int subsys_id; |
258 | int active; | 315 | int active; |
259 | int disabled; | 316 | int disabled; |
@@ -339,4 +396,13 @@ static inline int cgroupstats_build(struct cgroupstats *stats, | |||
339 | 396 | ||
340 | #endif /* !CONFIG_CGROUPS */ | 397 | #endif /* !CONFIG_CGROUPS */ |
341 | 398 | ||
399 | #ifdef CONFIG_MM_OWNER | ||
400 | extern void | ||
401 | cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new); | ||
402 | #else /* !CONFIG_MM_OWNER */ | ||
403 | static inline void | ||
404 | cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new) | ||
405 | { | ||
406 | } | ||
407 | #endif /* CONFIG_MM_OWNER */ | ||
342 | #endif /* _LINUX_CGROUP_H */ | 408 | #endif /* _LINUX_CGROUP_H */ |