diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 13:50:47 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 13:50:47 -0400 |
| commit | c0e8a139a5bb8add02b4111e9e1957d810d7285e (patch) | |
| tree | f5f0695c7553c0f651ea3c714191dedf76e06c78 /include/linux | |
| parent | 033d9959ed2dc1029217d4165f80a71702dc578e (diff) | |
| parent | a6f00298b2ceaf50b4ab00e6ee3eb0206ac72fac (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.h | 25 | ||||
| -rw-r--r-- | include/linux/cgroup_subsys.h | 24 | ||||
| -rw-r--r-- | include/linux/shmem_fs.h | 3 | ||||
| -rw-r--r-- | include/linux/xattr.h | 48 |
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) | ||
| 48 | enum cgroup_subsys_id { | 50 | enum 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. */ |
| 61 | struct cgroup_subsys_state { | 58 | struct 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 | */ |
| 395 | struct cftype_set { | 398 | struct 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 | ||
| 400 | struct cgroup_scanner { | 403 | struct cgroup_scanner { |
| @@ -406,8 +409,8 @@ struct cgroup_scanner { | |||
| 406 | void *data; | 409 | void *data; |
| 407 | }; | 410 | }; |
| 408 | 411 | ||
| 409 | int cgroup_add_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts); | 412 | int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); |
| 410 | int cgroup_rm_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts); | 413 | int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); |
| 411 | 414 | ||
| 412 | int cgroup_is_removed(const struct cgroup *cgrp); | 415 | int 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 | ||
| 527 | static inline struct cgroup_subsys_state *cgroup_subsys_state( | 532 | static 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) |
| 11 | SUBSYS(cpuset) | 11 | SUBSYS(cpuset) |
| 12 | #endif | 12 | #endif |
| 13 | 13 | ||
| 14 | /* */ | 14 | /* */ |
| 15 | 15 | ||
| 16 | #ifdef CONFIG_CGROUP_DEBUG | 16 | #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG) |
| 17 | SUBSYS(debug) | 17 | SUBSYS(debug) |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | /* */ | 20 | /* */ |
| 21 | 21 | ||
| 22 | #ifdef CONFIG_CGROUP_SCHED | 22 | #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED) |
| 23 | SUBSYS(cpu_cgroup) | 23 | SUBSYS(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) |
| 29 | SUBSYS(cpuacct) | 29 | SUBSYS(cpuacct) |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | /* */ | 32 | /* */ |
| 33 | 33 | ||
| 34 | #ifdef CONFIG_MEMCG | 34 | #if IS_SUBSYS_ENABLED(CONFIG_MEMCG) |
| 35 | SUBSYS(mem_cgroup) | 35 | SUBSYS(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) |
| 41 | SUBSYS(devices) | 41 | SUBSYS(devices) |
| 42 | #endif | 42 | #endif |
| 43 | 43 | ||
| 44 | /* */ | 44 | /* */ |
| 45 | 45 | ||
| 46 | #ifdef CONFIG_CGROUP_FREEZER | 46 | #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER) |
| 47 | SUBSYS(freezer) | 47 | SUBSYS(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) |
| 53 | SUBSYS(net_cls) | 53 | SUBSYS(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) |
| 59 | SUBSYS(blkio) | 59 | SUBSYS(blkio) |
| 60 | #endif | 60 | #endif |
| 61 | 61 | ||
| 62 | /* */ | 62 | /* */ |
| 63 | 63 | ||
| 64 | #ifdef CONFIG_CGROUP_PERF | 64 | #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF) |
| 65 | SUBSYS(perf) | 65 | SUBSYS(perf) |
| 66 | #endif | 66 | #endif |
| 67 | 67 | ||
| 68 | /* */ | 68 | /* */ |
| 69 | 69 | ||
| 70 | #ifdef CONFIG_NETPRIO_CGROUP | 70 | #if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP) |
| 71 | SUBSYS(net_prio) | 71 | SUBSYS(net_prio) |
| 72 | #endif | 72 | #endif |
| 73 | 73 | ||
| 74 | /* */ | 74 | /* */ |
| 75 | 75 | ||
