aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 13:50:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 13:50:47 -0400
commitc0e8a139a5bb8add02b4111e9e1957d810d7285e (patch)
treef5f0695c7553c0f651ea3c714191dedf76e06c78 /include/linux
parent033d9959ed2dc1029217d4165f80a71702dc578e (diff)
parenta6f00298b2ceaf50b4ab00e6ee3eb0206ac72fac (diff)
Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup updates from Tejun Heo: - xattr support added. The implementation is shared with tmpfs. The usage is restricted and intended to be used to manage per-cgroup metadata by system software. tmpfs changes are routed through this branch with Hugh's permission. - cgroup subsystem ID handling simplified. * 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: cgroup: Define CGROUP_SUBSYS_COUNT according the configuration cgroup: Assign subsystem IDs during compile time cgroup: Do not depend on a given order when populating the subsys array cgroup: Wrap subsystem selection macro cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT cgroup: net_prio: Do not define task_netpioidx() when not selected cgroup: net_cls: Do not define task_cls_classid() when not selected cgroup: net_cls: Move sock_update_classid() declaration to cls_cgroup.h cgroup: trivial fixes for Documentation/cgroups/cgroups.txt xattr: mark variable as uninitialized to make both gcc and smatch happy fs: add missing documentation to simple_xattr functions cgroup: add documentation on extended attributes usage cgroup: rename subsys_bits to subsys_mask cgroup: add xattr support cgroup: revise how we re-populate root directory xattr: extract simple_xattr code from tmpfs
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/cgroup.h25
-rw-r--r--include/linux/cgroup_subsys.h24
-rw-r--r--include/linux/shmem_fs.h3
-rw-r--r--include/linux/xattr.h48
4 files changed, 77 insertions, 23 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index c90eaa803440..df354ae079c1 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -17,6 +17,7 @@
17#include <linux/rwsem.h> 17#include <linux/rwsem.h>
18#include <linux/idr.h> 18#include <linux/idr.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20#include <linux/xattr.h>
20 21
21#ifdef CONFIG_CGROUPS 22#ifdef CONFIG_CGROUPS
22 23
@@ -45,17 +46,13 @@ extern const struct file_operations proc_cgroup_operations;
45 46
46/* Define the enumeration of all builtin cgroup subsystems */ 47/* Define the enumeration of all builtin cgroup subsystems */
47#define SUBSYS(_x) _x ## _subsys_id, 48#define SUBSYS(_x) _x ## _subsys_id,
49#define IS_SUBSYS_ENABLED(option) IS_ENABLED(option)
48enum cgroup_subsys_id { 50enum cgroup_subsys_id {
49#include <linux/cgroup_subsys.h> 51#include <linux/cgroup_subsys.h>
50 CGROUP_BUILTIN_SUBSYS_COUNT 52 CGROUP_SUBSYS_COUNT,
51}; 53};
54#undef IS_SUBSYS_ENABLED
52#undef SUBSYS 55#undef SUBSYS
53/*
54 * This define indicates the maximum number of subsystems that can be loaded
55 * at once. We limit to this many since cgroupfs_root has subsys_bits to keep
56 * track of all of them.
57 */
58#define CGROUP_SUBSYS_COUNT (BITS_PER_BYTE*sizeof(unsigned long))
59 56
60/* Per-subsystem/per-cgroup state maintained by the system. */ 57/* Per-subsystem/per-cgroup state maintained by the system. */
61struct cgroup_subsys_state { 58struct cgroup_subsys_state {
@@ -216,6 +213,9 @@ struct cgroup {
216 /* List of events which userspace want to receive */ 213 /* List of events which userspace want to receive */
217 struct list_head event_list; 214 struct list_head event_list;
218 spinlock_t event_list_lock; 215 spinlock_t event_list_lock;
216
217 /* directory xattrs */
218 struct simple_xattrs xattrs;
219}; 219};
220 220
221/* 221/*
@@ -309,6 +309,9 @@ struct cftype {
309 /* CFTYPE_* flags */ 309 /* CFTYPE_* flags */
310 unsigned int flags; 310 unsigned int flags;
311 311
312 /* file xattrs */
313 struct simple_xattrs xattrs;
314
312 int (*open)(struct inode *inode, struct file *file); 315 int (*open)(struct inode *inode, struct file *file);
313 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, 316 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft,
314 struct file *file, 317 struct file *file,
@@ -394,7 +397,7 @@ struct cftype {
394 */ 397 */
395struct cftype_set { 398struct cftype_set {
396 struct list_head node; /* chained at subsys->cftsets */ 399 struct list_head node; /* chained at subsys->cftsets */
397 const struct cftype *cfts; 400 struct cftype *cfts;
398}; 401};
399 402
400struct cgroup_scanner { 403struct cgroup_scanner {
@@ -406,8 +409,8 @@ struct cgroup_scanner {
406 void *data; 409 void *data;
407}; 410};
408 411
409int cgroup_add_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts); 412int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
410int cgroup_rm_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts); 413int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
411 414
412int cgroup_is_removed(const struct cgroup *cgrp); 415int cgroup_is_removed(const struct cgroup *cgrp);
413 416
@@ -521,7 +524,9 @@ struct cgroup_subsys {
521}; 524};
522 525
523#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; 526#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys;
527#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
524#include <linux/cgroup_subsys.h> 528#include <linux/cgroup_subsys.h>
529#undef IS_SUBSYS_ENABLED
525#undef SUBSYS 530#undef SUBSYS
526 531
527static inline struct cgroup_subsys_state *cgroup_subsys_state( 532static inline struct cgroup_subsys_state *cgroup_subsys_state(
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index dfae957398c3..f204a7a9cf38 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -7,73 +7,73 @@
7 7
8/* */ 8/* */
9 9
10#ifdef CONFIG_CPUSETS 10#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS)
11SUBSYS(cpuset) 11SUBSYS(cpuset)
12#endif 12#endif
13 13
14/* */ 14/* */
15 15
16#ifdef CONFIG_CGROUP_DEBUG 16#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG)
17SUBSYS(debug) 17SUBSYS(debug)
18#endif 18#endif
19 19
20/* */ 20/* */
21 21
22#ifdef CONFIG_CGROUP_SCHED 22#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED)
23SUBSYS(cpu_cgroup) 23SUBSYS(cpu_cgroup)
24#endif 24#endif
25 25
26/* */ 26/* */
27 27
28#ifdef CONFIG_CGROUP_CPUACCT 28#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT)
29SUBSYS(cpuacct) 29SUBSYS(cpuacct)
30#endif 30#endif
31 31
32/* */ 32/* */
33 33
34#ifdef CONFIG_MEMCG 34#if IS_SUBSYS_ENABLED(CONFIG_MEMCG)
35SUBSYS(mem_cgroup) 35SUBSYS(mem_cgroup)
36#endif 36#endif
37 37
38/* */ 38/* */
39 39
40#ifdef CONFIG_CGROUP_DEVICE 40#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE)
41SUBSYS(devices) 41SUBSYS(devices)
42#endif 42#endif
43 43
44/* */ 44/* */
45 45
46#ifdef CONFIG_CGROUP_FREEZER 46#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER)
47SUBSYS(freezer) 47SUBSYS(freezer)
48#endif 48#endif
49 49
50/* */ 50/* */
51 51
52#ifdef CONFIG_NET_CLS_CGROUP 52#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP)
53SUBSYS(net_cls) 53SUBSYS(net_cls)
54#endif 54#endif
55 55
56/* */ 56/* */
57 57
58#ifdef CONFIG_BLK_CGROUP 58#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP)
59SUBSYS(blkio) 59SUBSYS(blkio)
60#endif 60#endif
61 61
62/* */ 62/* */
63 63
64#ifdef CONFIG_CGROUP_PERF 64#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF)
65SUBSYS(perf) 65SUBSYS(perf)
66#endif 66#endif
67 67
68/* */ 68/* */
69 69
70#ifdef CONFIG_NETPRIO_CGROUP 70#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP)
71SUBSYS(net_prio) 71SUBSYS(net_prio)
72#endif 72#endif
73 73
74/* */ 74/* */
75 75