cgroup.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  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 *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. /* which pidlist file are we talking about? */
  139. enum cgroup_filetype {
  140. CGROUP_FILE_PROCS,
  141. CGROUP_FILE_TASKS,
  142. };
  143. /*
  144. * A pidlist is a list of pids that virtually represents the contents of one
  145. * of the cgroup files ("procs" or "tasks"). We keep a list of such pidlists,
  146. * a pair (one each for procs, tasks) for each pid namespace that's relevant
  147. * to the cgroup.
  148. */
  149. struct cgroup_pidlist {
  150. /*
  151. * used to find which pidlist is wanted. doesn't change as long as
  152. * this particular list stays in the list.
  153. */
  154. struct { enum cgroup_filetype type; struct pid_namespace *ns; } key;
  155. /* array of xids */
  156. pid_t *list;
  157. /* how many elements the above list has */
  158. int length;
  159. /* how many files are using the current array */
  160. int use_count;
  161. /* each of these stored in a list by its cgroup */
  162. struct list_head links;
  163. /* pointer to the cgroup we belong to, for list removal purposes */
  164. struct cgroup *owner;
  165. /* protects the other fields */
  166. struct rw_semaphore mutex;
  167. };
  168. struct cgroup {
  169. unsigned long flags; /* "unsigned long" so bitops work */
  170. /*
  171. * count users of this cgroup. >0 means busy, but doesn't
  172. * necessarily indicate the number of tasks in the cgroup
  173. */
  174. atomic_t count;
  175. /*
  176. * We link our 'sibling' struct into our parent's 'children'.
  177. * Our children link their 'sibling' into our 'children'.
  178. */
  179. struct list_head sibling; /* my parent's children */
  180. struct list_head children; /* my children */
  181. struct cgroup *parent; /* my parent */
  182. struct dentry *dentry; /* cgroup fs entry, RCU protected */
  183. /* Private pointers for each registered subsystem */
  184. struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
  185. struct cgroupfs_root *root;
  186. struct cgroup *top_cgroup;
  187. /*
  188. * List of cg_cgroup_links pointing at css_sets with
  189. * tasks in this cgroup. Protected by css_set_lock
  190. */
  191. struct list_head css_sets;
  192. /*
  193. * Linked list running through all cgroups that can
  194. * potentially be reaped by the release agent. Protected by
  195. * release_list_lock
  196. */
  197. struct list_head release_list;
  198. /*
  199. * list of pidlists, up to two for each namespace (one for procs, one
  200. * for tasks); created on demand.
  201. */
  202. struct list_head pidlists;
  203. struct mutex pidlist_mutex;
  204. /* For RCU-protected deletion */
  205. struct rcu_head rcu_head;
  206. /* List of events which userspace want to recieve */
  207. struct list_head event_list;
  208. spinlock_t event_list_lock;
  209. };
  210. /*
  211. * A css_set is a structure holding pointers to a set of
  212. * cgroup_subsys_state objects. This saves space in the task struct
  213. * object and speeds up fork()/exit(), since a single inc/dec and a
  214. * list_add()/del() can bump the reference count on the entire cgroup
  215. * set for a task.
  216. */
  217. struct css_set {
  218. /* Reference count */
  219. atomic_t refcount;
  220. /*
  221. * List running through all cgroup groups in the same hash
  222. * slot. Protected by css_set_lock
  223. */
  224. struct hlist_node hlist;
  225. /*
  226. * List running through all tasks using this cgroup
  227. * group. Protected by css_set_lock
  228. */
  229. struct list_head tasks;
  230. /*
  231. * List of cg_cgroup_link objects on link chains from
  232. * cgroups referenced from this css_set. Protected by
  233. * css_set_lock
  234. */
  235. struct list_head cg_links;
  236. /*
  237. * Set of subsystem states, one for each subsystem. This array
  238. * is immutable after creation apart from the init_css_set
  239. * during subsystem registration (at boot time) and modular subsystem
  240. * loading/unloading.
  241. */
  242. struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
  243. /* For RCU-protected deletion */
  244. struct rcu_head rcu_head;
  245. };
  246. /*
  247. * cgroup_map_cb is an abstract callback API for reporting map-valued
  248. * control files
  249. */
  250. struct cgroup_map_cb {
  251. int (*fill)(struct cgroup_map_cb *cb, const char *key, u64 value);
  252. void *state;
  253. };
  254. /*
  255. * struct cftype: handler definitions for cgroup control files
  256. *
  257. * When reading/writing to a file:
  258. * - the cgroup to use is file->f_dentry->d_parent->d_fsdata
  259. * - the 'cftype' of the file is file->f_dentry->d_fsdata
  260. */
  261. #define MAX_CFTYPE_NAME 64
  262. struct cftype {
  263. /*
  264. * By convention, the name should begin with the name of the
  265. * subsystem, followed by a period
  266. */
  267. char name[MAX_CFTYPE_NAME];
  268. int private;
  269. /*
  270. * If not 0, file mode is set to this value, otherwise it will
  271. * be figured out automatically
  272. */
  273. mode_t mode;
  274. /*
  275. * If non-zero, defines the maximum length of string that can
  276. * be passed to write_string; defaults to 64
  277. */
  278. size_t max_write_len;
  279. int (*open)(struct inode *inode, struct file *file);
  280. ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft,
  281. struct file *file,
  282. char __user *buf, size_t nbytes, loff_t *ppos);
  283. /*
  284. * read_u64() is a shortcut for the common case of returning a
  285. * single integer. Use it in place of read()
  286. */
  287. u64 (*read_u64)(struct cgroup *cgrp, struct cftype *cft);
  288. /*
  289. * read_s64() is a signed version of read_u64()
  290. */
  291. s64 (*read_s64)(struct cgroup *cgrp, struct cftype *cft);
  292. /*
  293. * read_map() is used for defining a map of key/value
  294. * pairs. It should call cb->fill(cb, key, value) for each
  295. * entry. The key/value pairs (and their ordering) should not
  296. * change between reboots.
  297. */
  298. int (*read_map)(struct cgroup *cont, struct cftype *cft,
  299. struct cgroup_map_cb *cb);
  300. /*
  301. * read_seq_string() is used for outputting a simple sequence
  302. * using seqfile.
  303. */
  304. int (*read_seq_string)(struct cgroup *cont, struct cftype *cft,
  305. struct seq_file *m);
  306. ssize_t (*write)(struct cgroup *cgrp, struct cftype *cft,
  307. struct file *file,
  308. const char __user *buf, size_t nbytes, loff_t *ppos);
  309. /*
  310. * write_u64() is a shortcut for the common case of accepting
  311. * a single integer (as parsed by simple_strtoull) from
  312. * userspace. Use in place of write(); return 0 or error.
  313. */
  314. int (*write_u64)(struct cgroup *cgrp, struct cftype *cft, u64 val);
  315. /*
  316. * write_s64() is a signed version of write_u64()
  317. */
  318. int (*write_s64)(struct cgroup *cgrp, struct cftype *cft, s64 val);
  319. /*
  320. * write_string() is passed a nul-terminated kernelspace
  321. * buffer of maximum length determined by max_write_len.
  322. * Returns 0 or -ve error code.
  323. */
  324. int (*write_string)(struct cgroup *cgrp, struct cftype *cft,
  325. const char *buffer);
  326. /*
  327. * trigger() callback can be used to get some kick from the
  328. * userspace, when the actual string written is not important
  329. * at all. The private field can be used to determine the
  330. * kick type for multiplexing.
  331. */
  332. int (*trigger)(struct cgroup *cgrp, unsigned int event);
  333. int (*release)(struct inode *inode, struct file *file);
  334. /*
  335. * register_event() callback will be used to add new userspace
  336. * waiter for changes related to the cftype. Implement it if
  337. * you want to provide this functionality. Use eventfd_signal()
  338. * on eventfd to send notification to userspace.
  339. */
  340. int (*register_event)(struct cgroup *cgrp, struct cftype *cft,
  341. struct eventfd_ctx *eventfd, const char *args);
  342. /*
  343. * unregister_event() callback will be called when userspace
  344. * closes the eventfd or on cgroup removing.
  345. * This callback must be implemented, if you want provide
  346. * notification functionality.
  347. */
  348. void (*unregister_event)(struct cgroup *cgrp, struct cftype *cft,
  349. struct eventfd_ctx *eventfd);
  350. };
  351. struct cgroup_scanner {
  352. struct cgroup *cg;
  353. int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan);
  354. void (*process_task)(struct task_struct *p,
  355. struct cgroup_scanner *scan);
  356. struct ptr_heap *heap;
  357. void *data;
  358. };
  359. /*
  360. * Add a new file to the given cgroup directory. Should only be
  361. * called by subsystems from within a populate() method
  362. */
  363. int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys,
  364. const struct cftype *cft);
  365. /*
  366. * Add a set of new files to the given cgroup directory. Should
  367. * only be called by subsystems from within a populate() method
  368. */
  369. int cgroup_add_files(struct cgroup *cgrp,
  370. struct cgroup_subsys *subsys,
  371. const struct cftype cft[],
  372. int count);
  373. int cgroup_is_removed(const struct cgroup *cgrp);
  374. int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
  375. int cgroup_task_count(const struct cgroup *cgrp);
  376. /* Return true if cgrp is a descendant of the task's cgroup */
  377. int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task);
  378. /*
  379. * When the subsys has to access css and may add permanent refcnt to css,
  380. * it should take care of racy conditions with rmdir(). Following set of
  381. * functions, is for stop/restart rmdir if necessary.
  382. * Because these will call css_get/put, "css" should be alive css.
  383. *
  384. * cgroup_exclude_rmdir();
  385. * ...do some jobs which may access arbitrary empty cgroup
  386. * cgroup_release_and_wakeup_rmdir();
  387. *
  388. * When someone removes a cgroup while cgroup_exclude_rmdir() holds it,
  389. * it sleeps and cgroup_release_and_wakeup_rmdir() will wake him up.
  390. */
  391. void cgroup_exclude_rmdir(struct cgroup_subsys_state *css);
  392. void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css);
  393. /*
  394. * Control Group subsystem type.
  395. * See Documentation/cgroups/cgroups.txt for details
  396. */
  397. struct cgroup_subsys {
  398. struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss,
  399. struct cgroup *cgrp);
  400. int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
  401. void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
  402. int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
  403. struct task_struct *tsk, bool threadgroup);
  404. void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
  405. struct task_struct *tsk, bool threadgroup);
  406. void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
  407. struct cgroup *old_cgrp, struct task_struct *tsk,
  408. bool threadgroup);
  409. void (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
  410. void (*exit)(struct cgroup_subsys *ss, struct task_struct *task);
  411. int (*populate)(struct cgroup_subsys *ss,
  412. struct cgroup *cgrp);
  413. void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp);
  414. void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
  415. int subsys_id;
  416. int active;
  417. int disabled;
  418. int early_init;
  419. /*
  420. * True if this subsys uses ID. ID is not available before cgroup_init()
  421. * (not available in early_init time.)
  422. */
  423. bool use_id;
  424. #define MAX_CGROUP_TYPE_NAMELEN 32
  425. const char *name;
  426. /*
  427. * Protects sibling/children links of cgroups in this
  428. * hierarchy, plus protects which hierarchy (or none) the
  429. * subsystem is a part of (i.e. root/sibling). To avoid
  430. * potential deadlocks, the following operations should not be
  431. * undertaken while holding any hierarchy_mutex:
  432. *
  433. * - allocating memory
  434. * - initiating hotplug events
  435. */
  436. struct mutex hierarchy_mutex;
  437. struct lock_class_key subsys_key;
  438. /*
  439. * Link to parent, and list entry in parent's children.
  440. * Protected by this->hierarchy_mutex and cgroup_lock()
  441. */
  442. struct cgroupfs_root *root;
  443. struct list_head sibling;
  444. /* used when use_id == true */
  445. struct idr idr;
  446. spinlock_t id_lock;
  447. /* should be defined only by modular subsystems */
  448. struct module *module;
  449. };
  450. #define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys;
  451. #include <linux/cgroup_subsys.h>
  452. #undef SUBSYS
  453. static inline struct cgroup_subsys_state *cgroup_subsys_state(
  454. struct cgroup *cgrp, int subsys_id)
  455. {
  456. return cgrp->subsys[subsys_id];
  457. }
  458. /*
  459. * function to get the cgroup_subsys_state which allows for extra
  460. * rcu_dereference_check() conditions, such as locks used during the
  461. * cgroup_subsys::attach() methods.
  462. */
  463. #define task_subsys_state_check(task, subsys_id, __c) \
  464. rcu_dereference_check(task->cgroups->subsys[subsys_id], \
  465. rcu_read_lock_held() || \
  466. lockdep_is_held(&task->alloc_lock) || \
  467. cgroup_lock_is_held() || (__c))
  468. static inline struct cgroup_subsys_state *
  469. task_subsys_state(struct task_struct *task, int subsys_id)
  470. {
  471. return task_subsys_state_check(task, subsys_id, false);
  472. }
  473. static inline struct cgroup* task_cgroup(struct task_struct *task,
  474. int subsys_id)
  475. {
  476. return task_subsys_state(task, subsys_id)->cgroup;
  477. }
  478. int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *ss,
  479. char *nodename);
  480. /* A cgroup_iter should be treated as an opaque object */
  481. struct cgroup_iter {
  482. struct list_head *cg_link;
  483. struct list_head *task;
  484. };
  485. /*
  486. * To iterate across the tasks in a cgroup:
  487. *
  488. * 1) call cgroup_iter_start to intialize an iterator
  489. *
  490. * 2) call cgroup_iter_next() to retrieve member tasks until it
  491. * returns NULL or until you want to end the iteration
  492. *
  493. * 3) call cgroup_iter_end() to destroy the iterator.
  494. *
  495. * Or, call cgroup_scan_tasks() to iterate through every task in a
  496. * cgroup - cgroup_scan_tasks() holds the css_set_lock when calling
  497. * the test_task() callback, but not while calling the process_task()
  498. * callback.
  499. */
  500. void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it);
  501. struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
  502. struct cgroup_iter *it);
  503. void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
  504. int cgroup_scan_tasks(struct cgroup_scanner *scan);
  505. int cgroup_attach_task(struct cgroup *, struct task_struct *);
  506. /*
  507. * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
  508. * if cgroup_subsys.use_id == true. It can be used for looking up and scanning.
  509. * CSS ID is assigned at cgroup allocation (create) automatically
  510. * and removed when subsys calls free_css_id() function. This is because
  511. * the lifetime of cgroup_subsys_state is subsys's matter.
  512. *
  513. * Looking up and scanning function should be called under rcu_read_lock().
  514. * Taking cgroup_mutex()/hierarchy_mutex() is not necessary for following calls.
  515. * But the css returned by this routine can be "not populated yet" or "being
  516. * destroyed". The caller should check css and cgroup's status.
  517. */
  518. /*
  519. * Typically Called at ->destroy(), or somewhere the subsys frees
  520. * cgroup_subsys_state.
  521. */
  522. void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css);
  523. /* Find a cgroup_subsys_state which has given ID */
  524. struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id);
  525. /*
  526. * Get a cgroup whose id is greater than or equal to id under tree of root.
  527. * Returning a cgroup_subsys_state or NULL.
  528. */
  529. struct cgroup_subsys_state *css_get_next(struct cgroup_subsys *ss, int id,
  530. struct cgroup_subsys_state *root, int *foundid);
  531. /* Returns true if root is ancestor of cg */
  532. bool css_is_ancestor(struct cgroup_subsys_state *cg,
  533. const struct cgroup_subsys_state *root);
  534. /* Get id and depth of css */
  535. unsigned short css_id(struct cgroup_subsys_state *css);
  536. unsigned short css_depth(struct cgroup_subsys_state *css);
  537. #else /* !CONFIG_CGROUPS */
  538. static inline int cgroup_init_early(void) { return 0; }
  539. static inline int cgroup_init(void) { return 0; }
  540. static inline void cgroup_fork(struct task_struct *p) {}
  541. static inline void cgroup_fork_callbacks(struct task_struct *p) {}
  542. static inline void cgroup_post_fork(struct task_struct *p) {}
  543. static inline void cgroup_exit(struct task_struct *p, int callbacks) {}
  544. static inline void cgroup_lock(void) {}
  545. static inline void cgroup_unlock(void) {}
  546. static inline int cgroupstats_build(struct cgroupstats *stats,
  547. struct dentry *dentry)
  548. {
  549. return -EINVAL;
  550. }
  551. #endif /* !CONFIG_CGROUPS */
  552. #endif /* _LINUX_CGROUP_H */