cgroup.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. #ifndef _LINUX_CGROUP_H
  2. #define _LINUX_CGROUP_H
  3. /*
  4. * cgroup interface
  5. *
  6. * Copyright (C) 2003 BULL SA
  7. * Copyright (C) 2004-2006 Silicon Graphics, Inc.
  8. *
  9. */
  10. #include <linux/sched.h>
  11. #include <linux/cpumask.h>
  12. #include <linux/nodemask.h>
  13. #include <linux/rcupdate.h>
  14. #include <linux/cgroupstats.h>
  15. #include <linux/prio_heap.h>
  16. #include <linux/rwsem.h>
  17. #include <linux/idr.h>
  18. #ifdef CONFIG_CGROUPS
  19. struct cgroupfs_root;
  20. struct cgroup_subsys;
  21. struct inode;
  22. struct cgroup;
  23. struct css_id;
  24. extern int cgroup_init_early(void);
  25. extern int cgroup_init(void);
  26. extern void cgroup_lock(void);
  27. extern int cgroup_lock_is_held(void);
  28. extern bool cgroup_lock_live_group(struct cgroup *cgrp);
  29. extern void cgroup_unlock(void);
  30. extern void cgroup_fork(struct task_struct *p);
  31. extern void cgroup_fork_callbacks(struct task_struct *p);
  32. extern void cgroup_post_fork(struct task_struct *p);
  33. extern void cgroup_exit(struct task_struct *p, int run_callbacks);
  34. extern int cgroupstats_build(struct cgroupstats *stats,
  35. struct dentry *dentry);
  36. extern int cgroup_load_subsys(struct cgroup_subsys *ss);
  37. extern void cgroup_unload_subsys(struct cgroup_subsys *ss);
  38. extern const struct file_operations proc_cgroup_operations;
  39. /* Define the enumeration of all builtin cgroup subsystems */
  40. #define SUBSYS(_x) _x ## _subsys_id,
  41. enum cgroup_subsys_id {
  42. #include <linux/cgroup_subsys.h>
  43. CGROUP_BUILTIN_SUBSYS_COUNT
  44. };
  45. #undef SUBSYS
  46. /*
  47. * This define indicates the maximum number of subsystems that can be loaded
  48. * at once. We limit to this many since cgroupfs_root has subsys_bits to keep
  49. * track of all of them.
  50. */
  51. #define CGROUP_SUBSYS_COUNT (BITS_PER_BYTE*sizeof(unsigned long))
  52. /* Per-subsystem/per-cgroup state maintained by the system. */
  53. struct cgroup_subsys_state {
  54. /*
  55. * The cgroup that this subsystem is attached to. Useful
  56. * for subsystems that want to know about the cgroup
  57. * hierarchy structure
  58. */
  59. struct cgroup *cgroup;
  60. /*
  61. * State maintained by the cgroup system to allow subsystems
  62. * to be "busy". Should be accessed via css_get(),
  63. * css_tryget() and and css_put().
  64. */
  65. atomic_t refcnt;
  66. unsigned long flags;
  67. /* ID for this css, if possible */
  68. struct css_id __rcu *id;
  69. };
  70. /* bits in struct cgroup_subsys_state flags field */
  71. enum {
  72. CSS_ROOT, /* This CSS is the root of the subsystem */
  73. CSS_REMOVED, /* This CSS is dead */
  74. };
  75. /* Caller must verify that the css is not for root cgroup */
  76. static inline void __css_get(struct cgroup_subsys_state *css, int count)
  77. {
  78. atomic_add(count, &css->refcnt);
  79. }
  80. /*
  81. * Call css_get() to hold a reference on the css; it can be used
  82. * for a reference obtained via:
  83. * - an existing ref-counted reference to the css
  84. * - task->cgroups for a locked task
  85. */
  86. static inline void css_get(struct cgroup_subsys_state *css)
  87. {
  88. /* We don't need to reference count the root state */
  89. if (!test_bit(CSS_ROOT, &css->flags))
  90. __css_get(css, 1);
  91. }
  92. static inline bool css_is_removed(struct cgroup_subsys_state *css)
  93. {
  94. return test_bit(CSS_REMOVED, &css->flags);
  95. }
  96. /*
  97. * Call css_tryget() to take a reference on a css if your existing
  98. * (known-valid) reference isn't already ref-counted. Returns false if
  99. * the css has been destroyed.
  100. */
  101. static inline bool css_tryget(struct cgroup_subsys_state *css)
  102. {
  103. if (test_bit(CSS_ROOT, &css->flags))
  104. return true;
  105. while (!atomic_inc_not_zero(&css->refcnt)) {
  106. if (test_bit(CSS_REMOVED, &css->flags))
  107. return false;
  108. cpu_relax();
  109. }
  110. return true;
  111. }
  112. /*
  113. * css_put() should be called to release a reference taken by
  114. * css_get() or css_tryget()
  115. */
  116. extern void __css_put(struct cgroup_subsys_state *css, int count);
  117. static inline void css_put(struct cgroup_subsys_state *css)
  118. {
  119. if (!test_bit(CSS_ROOT, &css->flags))
  120. __css_put(css, 1);
  121. }
  122. /* bits in struct cgroup flags field */
  123. enum {
  124. /* Control Group is dead */
  125. CGRP_REMOVED,
  126. /*
  127. * Control Group has previously had a child cgroup or a task,
  128. * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
  129. */
  130. CGRP_RELEASABLE,
  131. /* Control Group requires release notifications to userspace */
  132. CGRP_NOTIFY_ON_RELEASE,
  133. /*
  134. * A thread in rmdir() is wating for this cgroup.
  135. */
  136. CGRP_WAIT_ON_RMDIR,
  137. /*
  138. * Clone cgroup values when creating a new child cgroup
  139. */
  140. CGRP_CLONE_CHILDREN,
  141. };
  142. struct cgroup {
  143. unsigned long flags; /* "unsigned long" so bitops work */
  144. /*
  145. * count users of this cgroup. >0 means busy, but doesn't
  146. * necessarily indicate the number of tasks in the cgroup
  147. */
  148. atomic_t count;
  149. /*
  150. * We link our 'sibling' struct into our parent's 'children'.
  151. * Our children link their 'sibling' into our 'children'.
  152. */
  153. struct list_head sibling; /* my parent's children */
  154. struct list_head children; /* my children */
  155. struct cgroup *parent; /* my parent */
  156. struct dentry __rcu *dentry; /* cgroup fs entry, RCU protected */
  157. /* Private pointers for each registered subsystem */
  158. struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
  159. struct cgroupfs_root *root;
  160. struct cgroup *top_cgroup;
  161. /*
  162. * List of cg_cgroup_links pointing at css_sets with
  163. * tasks in this cgroup. Protected by css_set_lock
  164. */
  165. struct list_head css_sets;
  166. /*
  167. * Linked list running through all cgroups that can
  168. * potentially be reaped by the release agent. Protected by
  169. * release_list_lock
  170. */
  171. struct list_head release_list;
  172. /*
  173. * list of pidlists, up to two for each namespace (one for procs, one
  174. * for tasks); created on demand.
  175. */
  176. struct list_head pidlists;
  177. struct mutex pidlist_mutex;
  178. /* For RCU-protected deletion */
  179. struct rcu_head rcu_head;
  180. /* List of events which userspace want to receive */
  181. struct list_head event_list;
  182. spinlock_t event_list_lock;
  183. };
  184. /*
  185. * A css_set is a structure holding pointers to a set of
  186. * cgroup_subsys_state objects. This saves space in the task struct
  187. * object and speeds up fork()/exit(), since a single inc/dec and a
  188. * list_add()/del() can bump the reference count on the entire cgroup
  189. * set for a task.
  190. */
  191. struct css_set {
  192. /* Reference count */
  193. atomic_t refcount;
  194. /*
  195. * List running through all cgroup groups in the same hash
  196. * slot. Protected by css_set_lock
  197. */
  198. struct hlist_node hlist;
  199. /*
  200. * List running through all tasks using this cgroup
  201. * group. Protected by css_set_lock
  202. */
  203. struct list_head tasks;
  204. /*
  205. * List of cg_cgroup_link objects on link chains from
  206. * cgroups referenced from this css_set. Protected by
  207. * css_set_lock
  208. */
  209. struct list_head cg_links;
  210. /*
  211. * Set of subsystem states, one for each subsystem. This array
  212. * is immutable after creation apart from the init_css_set
  213. * during subsystem registration (at boot time) and modular subsystem
  214. * loading/unloading.
  215. */
  216. struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
  217. /* For RCU-protected deletion */
  218. struct rcu_head rcu_head;
  219. };
  220. /*
  221. * cgroup_map_cb is an abstract callback API for reporting map-valued
  222. * control files
  223. */
  224. struct cgroup_map_cb {
  225. int (*fill)(struct cgroup_map_cb *cb, const char *key, u64 value);
  226. void *state;
  227. };
  228. /*
  229. * struct cftype: handler definitions for cgroup control files
  230. *
  231. * When reading/writing to a file:
  232. * - the cgroup to use is file->f_dentry->d_parent->d_fsdata
  233. * - the 'cftype' of the file is file->f_dentry->d_fsdata
  234. */
  235. #define MAX_CFTYPE_NAME 64
  236. struct cftype {
  237. /*
  238. * By convention, the name should begin with the name of the
  239. * subsystem, followed by a period
  240. */
  241. char name[MAX_CFTYPE_NAME];
  242. int private;
  243. /*
  244. * If not 0, file mode is set to this value, otherwise it will
  245. * be figured out automatically
  246. */
  247. umode_t mode;
  248. /*
  249. * If non-zero, defines the maximum length of string that can
  250. * be passed to write_string; defaults to 64
  251. */
  252. size_t max_write_len;
  253. int (*open)(struct inode *inode, struct file *file);
  254. ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft,
  255. struct file *file,
  256. char __user *buf, size_t nbytes, loff_t *ppos);
  257. /*
  258. * read_u64() is a shortcut for the common case of returning a
  259. * single integer. Use it in place of read()
  260. */
  261. u64 (*read_u64)(struct cgroup *cgrp, struct cftype *cft);
  262. /*
  263. * read_s64() is a signed version of read_u64()
  264. */
  265. s64 (*read_s64)(struct cgroup *cgrp, struct cftype *cft);
  266. /*
  267. * read_map() is used for defining a map of key/value
  268. * pairs. It should call cb->fill(cb, key, value) for each
  269. * entry. The key/value pairs (and their ordering) should not
  270. * change between reboots.
  271. */
  272. int (*read_map)(struct cgroup *cont, struct cftype *cft,
  273. struct cgroup_map_cb *cb);
  274. /*
  275. * read_seq_string() is used for outputting a simple sequence
  276. * using seqfile.
  277. */
  278. int (*read_seq_string)(struct cgroup *cont, struct cftype *cft,
  279. struct seq_file *m);
  280. ssize_t (*write)(struct cgroup *cgrp, struct cftype *cft,
  281. struct file *file,
  282. const char __user *buf, size_t nbytes, loff_t *ppos);
  283. /*
  284. * write_u64() is a shortcut for the common case of accepting
  285. * a single integer (as parsed by simple_strtoull) from
  286. * userspace. Use in place of write(); return 0 or error.
  287. */
  288. int (*write_u64)(struct cgroup *cgrp, struct cftype *cft, u64 val);
  289. /*
  290. * write_s64() is a signed version of write_u64()
  291. */
  292. int (*write_s64)(struct cgroup *cgrp, struct cftype *cft, s64 val);
  293. /*
  294. * write_string() is passed a nul-terminated kernelspace
  295. * buffer of maximum length determined by max_write_len.
  296. * Returns 0 or -ve error code.
  297. */
  298. int (*write_string)(struct cgroup *cgrp, struct cftype *cft,
  299. const char *buffer);
  300. /*
  301. * trigger() callback can be used to get some kick from the
  302. * userspace, when the actual string written is not important
  303. * at all. The private field can be used to determine the
  304. * kick type for multiplexing.
  305. */
  306. int (*trigger)(struct cgroup *cgrp, unsigned int event);
  307. int (*release)(struct inode *inode, struct file *file);
  308. /*
  309. * register_event() callback will be used to add new userspace
  310. * waiter for changes related to the cftype. Implement it if
  311. * you want to provide this functionality. Use eventfd_signal()
  312. * on eventfd to send notification to userspace.
  313. */
  314. int (*register_event)(struct cgroup *cgrp, struct cftype *cft,
  315. struct eventfd_ctx *eventfd, const char *args);
  316. /*
  317. * unregister_event() callback will be called when userspace
  318. * closes the eventfd or on cgroup removing.
  319. * This callback must be implemented, if you want provide
  320. * notification functionality.
  321. */
  322. void (*unregister_event)(struct cgroup *cgrp, struct cftype *cft,
  323. struct eventfd_ctx *eventfd);
  324. };
  325. struct cgroup_scanner {
  326. struct cgroup *cg;
  327. int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan);
  328. void (*process_task)(struct task_struct *p,
  329. struct cgroup_scanner *scan);
  330. struct ptr_heap *heap;
  331. void *data;
  332. };
  333. /*
  334. * Add a new file to the given cgroup directory. Should only be
  335. * called by subsystems from within a populate() method
  336. */
  337. int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys,
  338. const struct cftype *cft);
  339. /*
  340. * Add a set of new files to the given cgroup directory. Should
  341. * only be called by subsystems from within a populate() method
  342. */
  343. int cgroup_add_files(struct cgroup *cgrp,
  344. struct cgroup_subsys *subsys,
  345. const struct cftype cft[],
  346. int count);
  347. int cgroup_is_removed(const struct cgroup *cgrp);
  348. int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
  349. int cgroup_task_count(const struct cgroup *cgrp);
  350. /* Return true if cgrp is a descendant of the task's cgroup */
  351. int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task);
  352. /*
  353. * When the subsys has to access css and may add permanent refcnt to css,
  354. * it should take care of racy conditions with rmdir(). Following set of
  355. * functions, is for stop/restart rmdir if necessary.
  356. * Because these will call css_get/put, "css" should be alive css.
  357. *
  358. * cgroup_exclude_rmdir();
  359. * ...do some jobs which may access arbitrary empty cgroup
  360. * cgroup_release_and_wakeup_rmdir();
  361. *
  362. * When someone removes a cgroup while cgroup_exclude_rmdir() holds it,
  363. * it sleeps and cgroup_release_and_wakeup_rmdir() will wake him up.
  364. */
  365. void cgroup_exclude_rmdir(struct cgroup_subsys_state *css);
  366. void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css);
  367. /*
  368. * Control Group taskset, used to pass around set of tasks to cgroup_subsys
  369. * methods.
  370. */
  371. struct cgroup_taskset;
  372. struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset);
  373. struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset);
  374. struct cgroup *cgroup_taskset_cur_cgroup(struct cgroup_taskset *tset);
  375. int cgroup_taskset_size(struct cgroup_taskset *tset);
  376. /**
  377. * cgroup_taskset_for_each - iterate cgroup_taskset
  378. * @task: the loop cursor
  379. * @skip_cgrp: skip if task's cgroup matches this, %NULL to iterate through all
  380. * @tset: taskset to iterate
  381. */
  382. #define cgroup_taskset_for_each(task, skip_cgrp, tset) \
  383. for ((task) = cgroup_taskset_first((tset)); (task); \
  384. (task) = cgroup_taskset_next((tset))) \
  385. if (!(skip_cgrp) || \
  386. cgroup_taskset_cur_cgroup((tset)) != (skip_cgrp))
  387. /*
  388. * Control Group subsystem type.
  389. * See Documentation/cgroups/cgroups.txt for details
  390. */
  391. struct cgroup_subsys {
  392. struct cgroup_subsys_state *(*create)(struct cgroup *cgrp);
  393. int (*pre_destroy)(struct cgroup *cgrp);
  394. void (*destroy)(struct cgroup *cgrp);
  395. int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
  396. void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
  397. void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
  398. void (*fork)(struct task_struct *task);
  399. void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp,
  400. struct task_struct *task);
  401. int (*populate)(struct cgroup_subsys *ss, struct cgroup *cgrp);
  402. void (*post_clone)(struct cgroup *cgrp);
  403. void (*bind)(struct cgroup *root);
  404. int subsys_id;
  405. int active;
  406. int disabled;
  407. int early_init;
  408. /*
  409. * True if this subsys uses ID. ID is not available before cgroup_init()
  410. * (not available in early_init time.)
  411. */
  412. bool use_id;
  413. #define MAX_CGROUP_TYPE_NAMELEN 32
  414. const char *name;
  415. /*
  416. * Protects sibling/children links of cgroups in this
  417. * hierarchy, plus protects which hierarchy (or none) the
  418. * subsystem is a part of (i.e. root/sibling). To avoid
  419. * potential deadlocks, the following operations should not be
  420. * undertaken while holding any hierarchy_mutex:
  421. *
  422. * - allocating memory
  423. * - initiating hotplug events
  424. */
  425. struct mutex hierarchy_mutex;
  426. struct lock_class_key subsys_key;
  427. /*
  428. * Link to parent, and list entry in parent's children.
  429. * Protected by this->hierarchy_mutex and cgroup_lock()
  430. */
  431. struct cgroupfs_root *root;
  432. struct list_head sibling;
  433. /* used when use_id == true */
  434. struct idr idr;
  435. spinlock_t id_lock;
  436. /* should be defined only by modular subsystems */
  437. struct module *module;
  438. };
  439. #define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys;
  440. #include <linux/cgroup_subsys.h>
  441. #undef SUBSYS
  442. static inline struct cgroup_subsys_state *cgroup_subsys_state(
  443. struct cgroup *cgrp, int subsys_id)
  444. {
  445. return cgrp->subsys[subsys_id];
  446. }
  447. /*
  448. * function to get the cgroup_subsys_state which allows for extra
  449. * rcu_dereference_check() conditions, such as locks used during the
  450. * cgroup_subsys::attach() methods.
  451. */
  452. #define task_subsys_state_check(task, subsys_id, __c) \
  453. rcu_dereference_check(task->cgroups->subsys[subsys_id], \
  454. lockdep_is_held(&task->alloc_lock) || \
  455. cgroup_lock_is_held() || (__c))
  456. static inline struct cgroup_subsys_state *
  457. task_subsys_state(struct task_struct *task, int subsys_id)
  458. {
  459. return task_subsys_state_check(task, subsys_id, false);
  460. }
  461. static inline struct cgroup* task_cgroup(struct task_struct *task,
  462. int subsys_id)
  463. {
  464. return task_subsys_state(task, subsys_id)->cgroup;
  465. }
  466. /* A cgroup_iter should be treated as an opaque object */
  467. struct cgroup_iter {
  468. struct list_head *cg_link;
  469. struct list_head *task;
  470. };
  471. /*
  472. * To iterate across the tasks in a cgroup:
  473. *
  474. * 1) call cgroup_iter_start to initialize an iterator
  475. *
  476. * 2) call cgroup_iter_next() to retrieve member tasks until it
  477. * returns NULL or until you want to end the iteration
  478. *
  479. * 3) call cgroup_iter_end() to destroy the iterator.
  480. *
  481. * Or, call cgroup_scan_tasks() to iterate through every task in a
  482. * cgroup - cgroup_scan_tasks() holds the css_set_lock when calling
  483. * the test_task() callback, but not while calling the process_task()
  484. * callback.
  485. */
  486. void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it);
  487. struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
  488. struct cgroup_iter *it);
  489. void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
  490. int cgroup_scan_tasks(struct cgroup_scanner *scan);
  491. int cgroup_attach_task(struct cgroup *, struct task_struct *);
  492. int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
  493. /*
  494. * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
  495. * if cgroup_subsys.use_id == true. It can be used for looking up and scanning.
  496. * CSS ID is assigned at cgroup allocation (create) automatically
  497. * and removed when subsys calls free_css_id() function. This is because
  498. * the lifetime of cgroup_subsys_state is subsys's matter.
  499. *
  500. * Looking up and scanning function should be called under rcu_read_lock().
  501. * Taking cgroup_mutex()/hierarchy_mutex() is not necessary for following calls.
  502. * But the css returned by this routine can be "not populated yet" or "being
  503. * destroyed". The caller should check css and cgroup's status.
  504. */
  505. /*
  506. * Typically Called at ->destroy(), or somewhere the subsys frees
  507. * cgroup_subsys_state.
  508. */
  509. void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css);
  510. /* Find a cgroup_subsys_state which has given ID */
  511. struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id);
  512. /*
  513. * Get a cgroup whose id is greater than or equal to id under tree of root.
  514. * Returning a cgroup_subsys_state or NULL.
  515. */
  516. struct cgroup_subsys_state *css_get_next(struct cgroup_subsys *ss, int id,
  517. struct cgroup_subsys_state *root, int *foundid);
  518. /* Returns true if root is ancestor of cg */
  519. bool css_is_ancestor(struct cgroup_subsys_state *cg,
  520. const struct cgroup_subsys_state *root);
  521. /* Get id and depth of css */
  522. unsigned short css_id(struct cgroup_subsys_state *css);
  523. unsigned short css_depth(struct cgroup_subsys_state *css);
  524. struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
  525. #else /* !CONFIG_CGROUPS */
  526. static inline int cgroup_init_early(void) { return 0; }
  527. static inline int cgroup_init(void) { return 0; }
  528. static inline void cgroup_fork(struct task_struct *p) {}
  529. static inline void cgroup_fork_callbacks(struct task_struct *p) {}
  530. static inline void cgroup_post_fork(struct task_struct *p) {}
  531. static inline void cgroup_exit(struct task_struct *p, int callbacks) {}
  532. static inline void cgroup_lock(void) {}
  533. static inline void cgroup_unlock(void) {}
  534. static inline int cgroupstats_build(struct cgroupstats *stats,
  535. struct dentry *dentry)
  536. {
  537. return -EINVAL;
  538. }
  539. /* No cgroups - nothing to do */
  540. static inline int cgroup_attach_task_all(struct task_struct *from,
  541. struct task_struct *t)
  542. {
  543. return 0;
  544. }
  545. #endif /* !CONFIG_CGROUPS */
  546. #endif /* _LINUX_CGROUP_H */