diff options
-rw-r--r-- | block/blk-cgroup.c | 8 | ||||
-rw-r--r-- | block/blk-cgroup.h | 2 | ||||
-rw-r--r-- | fs/bio.c | 2 | ||||
-rw-r--r-- | include/linux/cgroup.h | 7 | ||||
-rw-r--r-- | include/linux/cgroup_subsys.h | 6 | ||||
-rw-r--r-- | include/linux/hugetlb_cgroup.h | 2 | ||||
-rw-r--r-- | include/linux/memcontrol.h | 2 | ||||
-rw-r--r-- | include/net/cls_cgroup.h | 2 | ||||
-rw-r--r-- | include/net/netprio_cgroup.h | 2 | ||||
-rw-r--r-- | kernel/cgroup.c | 34 | ||||
-rw-r--r-- | kernel/cgroup_freezer.c | 8 | ||||
-rw-r--r-- | kernel/cpuset.c | 10 | ||||
-rw-r--r-- | kernel/events/core.c | 8 | ||||
-rw-r--r-- | kernel/sched/core.c | 6 | ||||
-rw-r--r-- | kernel/sched/cpuacct.c | 6 | ||||
-rw-r--r-- | mm/hugetlb_cgroup.c | 9 | ||||
-rw-r--r-- | mm/memcontrol.c | 22 | ||||
-rw-r--r-- | net/core/netclassid_cgroup.c | 6 | ||||
-rw-r--r-- | net/core/netprio_cgroup.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp_memcontrol.c | 2 | ||||
-rw-r--r-- | security/device_cgroup.c | 8 |
21 files changed, 68 insertions, 88 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 660d419918a7..1cef07cf9c21 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -906,16 +906,14 @@ static int blkcg_can_attach(struct cgroup_subsys_state *css, | |||
906 | return ret; | 906 | return ret; |
907 | } | 907 | } |
908 | 908 | ||
909 | struct cgroup_subsys blkio_subsys = { | 909 | struct cgroup_subsys blkio_cgrp_subsys = { |
910 | .name = "blkio", | ||
911 | .css_alloc = blkcg_css_alloc, | 910 | .css_alloc = blkcg_css_alloc, |
912 | .css_offline = blkcg_css_offline, | 911 | .css_offline = blkcg_css_offline, |
913 | .css_free = blkcg_css_free, | 912 | .css_free = blkcg_css_free, |
914 | .can_attach = blkcg_can_attach, | 913 | .can_attach = blkcg_can_attach, |
915 | .subsys_id = blkio_subsys_id, | ||
916 | .base_cftypes = blkcg_files, | 914 | .base_cftypes = blkcg_files, |
917 | }; | 915 | }; |
918 | EXPORT_SYMBOL_GPL(blkio_subsys); | 916 | EXPORT_SYMBOL_GPL(blkio_cgrp_subsys); |
919 | 917 | ||
920 | /** | 918 | /** |
921 | * blkcg_activate_policy - activate a blkcg policy on a request_queue | 919 | * blkcg_activate_policy - activate a blkcg policy on a request_queue |
@@ -1105,7 +1103,7 @@ int blkcg_policy_register(struct blkcg_policy *pol) | |||
1105 | 1103 | ||
1106 | /* everything is in place, add intf files for the new policy */ | 1104 | /* everything is in place, add intf files for the new policy */ |
1107 | if (pol->cftypes) | 1105 | if (pol->cftypes) |
1108 | WARN_ON(cgroup_add_cftypes(&blkio_subsys, pol->cftypes)); | 1106 | WARN_ON(cgroup_add_cftypes(&blkio_cgrp_subsys, pol->cftypes)); |
1109 | ret = 0; | 1107 | ret = 0; |
1110 | out_unlock: | 1108 | out_unlock: |
1111 | mutex_unlock(&blkcg_pol_mutex); | 1109 | mutex_unlock(&blkcg_pol_mutex); |
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 86154eab9523..453b528c8e19 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -186,7 +186,7 @@ static inline struct blkcg *css_to_blkcg(struct cgroup_subsys_state *css) | |||
186 | 186 | ||
187 | static inline struct blkcg *task_blkcg(struct task_struct *tsk) | 187 | static inline struct blkcg *task_blkcg(struct task_struct *tsk) |
188 | { | 188 | { |
189 | return css_to_blkcg(task_css(tsk, blkio_subsys_id)); | 189 | return css_to_blkcg(task_css(tsk, blkio_cgrp_id)); |
190 | } | 190 | } |
191 | 191 | ||
192 | static inline struct blkcg *bio_blkcg(struct bio *bio) | 192 | static inline struct blkcg *bio_blkcg(struct bio *bio) |
@@ -1965,7 +1965,7 @@ int bio_associate_current(struct bio *bio) | |||
1965 | 1965 | ||
1966 | /* associate blkcg if exists */ | 1966 | /* associate blkcg if exists */ |
1967 | rcu_read_lock(); | 1967 | rcu_read_lock(); |
1968 | css = task_css(current, blkio_subsys_id); | 1968 | css = task_css(current, blkio_cgrp_id); |
1969 | if (css && css_tryget(css)) | 1969 | if (css && css_tryget(css)) |
1970 | bio->bi_css = css; | 1970 | bio->bi_css = css; |
1971 | rcu_read_unlock(); | 1971 | rcu_read_unlock(); |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index d842a737d448..cd6611e622fd 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -41,7 +41,7 @@ extern int cgroupstats_build(struct cgroupstats *stats, | |||
41 | extern int proc_cgroup_show(struct seq_file *, void *); | 41 | extern int proc_cgroup_show(struct seq_file *, void *); |
42 | 42 | ||
43 | /* define the enumeration of all cgroup subsystems */ | 43 | /* define the enumeration of all cgroup subsystems */ |
44 | #define SUBSYS(_x) _x ## _subsys_id, | 44 | #define SUBSYS(_x) _x ## _cgrp_id, |
45 | enum cgroup_subsys_id { | 45 | enum cgroup_subsys_id { |
46 | #include <linux/cgroup_subsys.h> | 46 | #include <linux/cgroup_subsys.h> |
47 | CGROUP_SUBSYS_COUNT, | 47 | CGROUP_SUBSYS_COUNT, |
@@ -573,7 +573,6 @@ struct cgroup_subsys { | |||
573 | struct task_struct *task); | 573 | struct task_struct *task); |
574 | void (*bind)(struct cgroup_subsys_state *root_css); | 574 | void (*bind)(struct cgroup_subsys_state *root_css); |
575 | 575 | ||
576 | int subsys_id; | ||
577 | int disabled; | 576 | int disabled; |
578 | int early_init; | 577 | int early_init; |
579 | 578 | ||
@@ -592,6 +591,8 @@ struct cgroup_subsys { | |||
592 | bool broken_hierarchy; | 591 | bool broken_hierarchy; |
593 | bool warned_broken_hierarchy; | 592 | bool warned_broken_hierarchy; |
594 | 593 | ||
594 | /* the following two fields are initialized automtically during boot */ | ||
595 | int subsys_id; | ||
595 | #define MAX_CGROUP_TYPE_NAMELEN 32 | 596 | #define MAX_CGROUP_TYPE_NAMELEN 32 |
596 | const char *name; | 597 | const char *name; |
597 | 598 | ||
@@ -606,7 +607,7 @@ struct cgroup_subsys { | |||
606 | struct cftype_set base_cftset; | 607 | struct cftype_set base_cftset; |
607 | }; | 608 | }; |
608 | 609 | ||
609 | #define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; | 610 | #define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys; |
610 | #include <linux/cgroup_subsys.h> | 611 | #include <linux/cgroup_subsys.h> |
611 | #undef SUBSYS | 612 | #undef SUBSYS |
612 | 613 | ||
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h index 11c42f6a25a8..768fe44e19f0 100644 --- a/include/linux/cgroup_subsys.h +++ b/include/linux/cgroup_subsys.h | |||
@@ -12,7 +12,7 @@ SUBSYS(debug) | |||
12 | #endif | 12 | #endif |
13 | 13 | ||
14 | #if IS_ENABLED(CONFIG_CGROUP_SCHED) | 14 | #if IS_ENABLED(CONFIG_CGROUP_SCHED) |
15 | SUBSYS(cpu_cgroup) | 15 | SUBSYS(cpu) |
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | #if IS_ENABLED(CONFIG_CGROUP_CPUACCT) | 18 | #if IS_ENABLED(CONFIG_CGROUP_CPUACCT) |
@@ -20,7 +20,7 @@ SUBSYS(cpuacct) | |||
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #if IS_ENABLED(CONFIG_MEMCG) | 22 | #if IS_ENABLED(CONFIG_MEMCG) |
23 | SUBSYS(mem_cgroup) | 23 | SUBSYS(memory) |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | #if IS_ENABLED(CONFIG_CGROUP_DEVICE) | 26 | #if IS_ENABLED(CONFIG_CGROUP_DEVICE) |
@@ -40,7 +40,7 @@ SUBSYS(blkio) | |||
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #if IS_ENABLED(CONFIG_CGROUP_PERF) | 42 | #if IS_ENABLED(CONFIG_CGROUP_PERF) |
43 | SUBSYS(perf) | 43 | SUBSYS(perf_event) |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #if IS_ENABLED(CONFIG_CGROUP_NET_PRIO) | 46 | #if IS_ENABLED(CONFIG_CGROUP_NET_PRIO) |
diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h index 787bba3bf552..0129f89cf98d 100644 --- a/include/linux/hugetlb_cgroup.h +++ b/include/linux/hugetlb_cgroup.h | |||
@@ -49,7 +49,7 @@ int set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg) | |||
49 | 49 | ||
50 | static inline bool hugetlb_cgroup_disabled(void) | 50 | static inline bool hugetlb_cgroup_disabled(void) |
51 | { | 51 | { |
52 | if (hugetlb_subsys.disabled) | 52 | if (hugetlb_cgrp_subsys.disabled) |
53 | return true; | 53 | return true; |
54 | return false; | 54 | return false; |
55 | } | 55 | } |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index abd0113b6620..eccfb4a4b379 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -162,7 +162,7 @@ extern int do_swap_account; | |||
162 | 162 | ||
163 | static inline bool mem_cgroup_disabled(void) | 163 | static inline bool mem_cgroup_disabled(void) |
164 | { | 164 | { |
165 | if (mem_cgroup_subsys.disabled) | 165 | if (memory_cgrp_subsys.disabled) |
166 | return true; | 166 | return true; |
167 | return false; | 167 | return false; |
168 | } | 168 | } |
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h index 9cf2d5ef38d9..c15d39456e14 100644 --- a/include/net/cls_cgroup.h +++ b/include/net/cls_cgroup.h | |||
@@ -34,7 +34,7 @@ static inline u32 task_cls_classid(struct task_struct *p) | |||
34 | return 0; | 34 | return 0; |
35 | 35 | ||
36 | rcu_read_lock(); | 36 | rcu_read_lock(); |
37 | classid = container_of(task_css(p, net_cls_subsys_id), | 37 | classid = container_of(task_css(p, net_cls_cgrp_id), |
38 | struct cgroup_cls_state, css)->classid; | 38 | struct cgroup_cls_state, css)->classid; |
39 | rcu_read_unlock(); | 39 | rcu_read_unlock(); |
40 | 40 | ||
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h index b7ff5bd3c3c3..f2a9597ff53c 100644 --- a/include/net/netprio_cgroup.h +++ b/include/net/netprio_cgroup.h | |||
@@ -33,7 +33,7 @@ static inline u32 task_netprioidx(struct task_struct *p) | |||
33 | u32 idx; | 33 | u32 idx; |
34 | 34 | ||
35 | rcu_read_lock(); | 35 | rcu_read_lock(); |
36 | css = task_css(p, net_prio_subsys_id); | 36 | css = task_css(p, net_prio_cgrp_id); |
37 | idx = css->cgroup->id; | 37 | idx = css->cgroup->id; |
38 | rcu_read_unlock(); | 38 | rcu_read_unlock(); |
39 | return idx; | 39 | return idx; |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index ccb16b47e293..fe3f7253aa90 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -120,10 +120,18 @@ static struct workqueue_struct *cgroup_destroy_wq; | |||
120 | static struct workqueue_struct *cgroup_pidlist_destroy_wq; | 120 | static struct workqueue_struct *cgroup_pidlist_destroy_wq; |
121 | 121 | ||
122 | /* generate an array of cgroup subsystem pointers */ | 122 | /* generate an array of cgroup subsystem pointers */ |
123 | #define SUBSYS(_x) [_x ## _subsys_id] = &_x ## _subsys, | 123 | #define SUBSYS(_x) [_x ## _cgrp_id] = &_x ## _cgrp_subsys, |
124 | static struct cgroup_subsys *cgroup_subsys[] = { | 124 | static struct cgroup_subsys *cgroup_subsys[] = { |
125 | #include <linux/cgroup_subsys.h> | 125 | #include <linux/cgroup_subsys.h> |
126 | }; | 126 | }; |
127 | #undef SUBSYS | ||
128 | |||
129 | /* array of cgroup subsystem names */ | ||
130 | #define SUBSYS(_x) [_x ## _cgrp_id] = #_x, | ||
131 | static const char *cgroup_subsys_name[] = { | ||
132 | #include <linux/cgroup_subsys.h> | ||
133 | }; | ||
134 | #undef SUBSYS | ||
127 | 135 | ||
128 | /* | 136 | /* |
129 | * The dummy hierarchy, reserved for the subsystems that are otherwise | 137 | * The dummy hierarchy, reserved for the subsystems that are otherwise |
@@ -1076,7 +1084,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts) | |||
1076 | BUG_ON(!mutex_is_locked(&cgroup_mutex)); | 1084 | BUG_ON(!mutex_is_locked(&cgroup_mutex)); |
1077 | 1085 | ||
1078 | #ifdef CONFIG_CPUSETS | 1086 | #ifdef CONFIG_CPUSETS |
1079 | mask = ~(1UL << cpuset_subsys_id); | 1087 | mask = ~(1UL << cpuset_cgrp_id); |
1080 | #endif | 1088 | #endif |
1081 | 1089 | ||
1082 | memset(opts, 0, sizeof(*opts)); | 1090 | memset(opts, 0, sizeof(*opts)); |
@@ -4528,15 +4536,15 @@ int __init cgroup_init_early(void) | |||
4528 | list_add(&init_cgrp_cset_link.cgrp_link, &init_css_set.cgrp_links); | 4536 | list_add(&init_cgrp_cset_link.cgrp_link, &init_css_set.cgrp_links); |
4529 | 4537 | ||
4530 | for_each_subsys(ss, i) { | 4538 | for_each_subsys(ss, i) { |
4531 | BUG_ON(!ss->name); | 4539 | WARN(!ss->css_alloc || !ss->css_free || ss->name || ss->subsys_id, |
4532 | BUG_ON(strlen(ss->name) > MAX_CGROUP_TYPE_NAMELEN); | 4540 | "invalid cgroup_subsys %d:%s css_alloc=%p css_free=%p name:id=%d:%s\n", |
4533 | BUG_ON(!ss->css_alloc); | 4541 | i, cgroup_subsys_name[i], ss->css_alloc, ss->css_free, |
4534 | BUG_ON(!ss->css_free); | 4542 | ss->subsys_id, ss->name); |
4535 | if (ss->subsys_id != i) { | 4543 | WARN(strlen(cgroup_subsys_name[i]) > MAX_CGROUP_TYPE_NAMELEN, |
4536 | printk(KERN_ERR "cgroup: Subsys %s id == %d\n", | 4544 | "cgroup_subsys_name %s too long\n", cgroup_subsys_name[i]); |
4537 | ss->name, ss->subsys_id); | 4545 | |
4538 | BUG(); | 4546 | ss->subsys_id = i; |
4539 | } | 4547 | ss->name = cgroup_subsys_name[i]; |
4540 | 4548 | ||
4541 | if (ss->early_init) | 4549 | if (ss->early_init) |
4542 | cgroup_init_subsys(ss); | 4550 | cgroup_init_subsys(ss); |
@@ -5167,11 +5175,9 @@ static struct cftype debug_files[] = { | |||
5167 | { } /* terminate */ | 5175 | { } /* terminate */ |
5168 | }; | 5176 | }; |
5169 | 5177 | ||
5170 | struct cgroup_subsys debug_subsys = { | 5178 | struct cgroup_subsys debug_cgrp_subsys = { |
5171 | .name = "debug", | ||
5172 | .css_alloc = debug_css_alloc, | 5179 | .css_alloc = debug_css_alloc, |
5173 | .css_free = debug_css_free, | 5180 | .css_free = debug_css_free, |
5174 | .subsys_id = debug_subsys_id, | ||
5175 | .base_cftypes = debug_files, | 5181 | .base_cftypes = debug_files, |
5176 | }; | 5182 | }; |
5177 | #endif /* CONFIG_CGROUP_DEBUG */ | 5183 | #endif /* CONFIG_CGROUP_DEBUG */ |
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index 6c3154e477f6..98ea26a99076 100644 --- a/kernel/cgroup_freezer.c +++ b/kernel/cgroup_freezer.c | |||
@@ -52,7 +52,7 @@ static inline struct freezer *css_freezer(struct cgroup_subsys_state *css) | |||
52 | 52 | ||
53 | static inline struct freezer *task_freezer(struct task_struct *task) | 53 | static inline struct freezer *task_freezer(struct task_struct *task) |
54 | { | 54 | { |
55 | return css_freezer(task_css(task, freezer_subsys_id)); | 55 | return css_freezer(task_css(task, freezer_cgrp_id)); |
56 | } | 56 | } |
57 | 57 | ||
58 | static struct freezer *parent_freezer(struct freezer *freezer) | 58 | static struct freezer *parent_freezer(struct freezer *freezer) |
@@ -84,8 +84,6 @@ static const char *freezer_state_strs(unsigned int state) | |||
84 | return "THAWED"; | 84 | return "THAWED"; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | struct cgroup_subsys freezer_subsys; | ||
88 | |||
89 | static struct cgroup_subsys_state * | 87 | static struct cgroup_subsys_state * |
90 | freezer_css_alloc(struct cgroup_subsys_state *parent_css) | 88 | freezer_css_alloc(struct cgroup_subsys_state *parent_css) |
91 | { | 89 | { |
@@ -473,13 +471,11 @@ static struct cftype files[] = { | |||
473 | { } /* terminate */ | 471 | { } /* terminate */ |
474 | }; | 472 | }; |
475 | 473 | ||
476 | struct cgroup_subsys freezer_subsys = { | 474 | struct cgroup_subsys freezer_cgrp_subsys = { |
477 | .name = "freezer", | ||
478 | .css_alloc = freezer_css_alloc, | 475 | .css_alloc = freezer_css_alloc, |
479 | .css_online = freezer_css_online, | 476 | .css_online = freezer_css_online, |
480 | .css_offline = freezer_css_offline, | 477 | .css_offline = freezer_css_offline, |
481 | .css_free = freezer_css_free, | 478 | .css_free = freezer_css_free, |
482 | .subsys_id = freezer_subsys_id, | ||
483 | .attach = freezer_attach, | 479 | .attach = freezer_attach, |
484 | .fork = freezer_fork, | 480 | .fork = freezer_fork, |
485 | .base_cftypes = files, | 481 | .base_cftypes = files, |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 4410ac6a55f1..2d018c795fea 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -119,7 +119,7 @@ static inline struct cpuset *css_cs(struct cgroup_subsys_state *css) | |||
119 | /* Retrieve the cpuset for a task */ | 119 | /* Retrieve the cpuset for a task */ |
120 | static inline struct cpuset *task_cs(struct task_struct *task) | 120 | static inline struct cpuset *task_cs(struct task_struct *task) |
121 | { | 121 | { |
122 | return css_cs(task_css(task, cpuset_subsys_id)); | 122 | return css_cs(task_css(task, cpuset_cgrp_id)); |
123 | } | 123 | } |
124 | 124 | ||
125 | static inline struct cpuset *parent_cs(struct cpuset *cs) | 125 | static inline struct cpuset *parent_cs(struct cpuset *cs) |
@@ -1521,7 +1521,7 @@ static void cpuset_attach(struct cgroup_subsys_state *css, | |||
1521 | struct task_struct *task; | 1521 | struct task_struct *task; |
1522 | struct task_struct *leader = cgroup_taskset_first(tset); | 1522 | struct task_struct *leader = cgroup_taskset_first(tset); |
1523 | struct cgroup_subsys_state *oldcss = cgroup_taskset_cur_css(tset, | 1523 | struct cgroup_subsys_state *oldcss = cgroup_taskset_cur_css(tset, |
1524 | cpuset_subsys_id); | 1524 | cpuset_cgrp_id); |
1525 | struct cpuset *cs = css_cs(css); | 1525 | struct cpuset *cs = css_cs(css); |
1526 | struct cpuset *oldcs = css_cs(oldcss); | 1526 | struct cpuset *oldcs = css_cs(oldcss); |
1527 | struct cpuset *cpus_cs = effective_cpumask_cpuset(cs); | 1527 | struct cpuset *cpus_cs = effective_cpumask_cpuset(cs); |
@@ -2024,8 +2024,7 @@ static void cpuset_css_free(struct cgroup_subsys_state *css) | |||
2024 | kfree(cs); | 2024 | kfree(cs); |
2025 | } | 2025 | } |
2026 | 2026 | ||
2027 | struct cgroup_subsys cpuset_subsys = { | 2027 | struct cgroup_subsys cpuset_cgrp_subsys = { |
2028 | .name = "cpuset", | ||
2029 | .css_alloc = cpuset_css_alloc, | 2028 | .css_alloc = cpuset_css_alloc, |
2030 | .css_online = cpuset_css_online, | 2029 | .css_online = cpuset_css_online, |
2031 | .css_offline = cpuset_css_offline, | 2030 | .css_offline = cpuset_css_offline, |
@@ -2033,7 +2032,6 @@ struct cgroup_subsys cpuset_subsys = { | |||
2033 | .can_attach = cpuset_can_attach, | 2032 | .can_attach = cpuset_can_attach, |
2034 | .cancel_attach = cpuset_cancel_attach, | 2033 | .cancel_attach = cpuset_cancel_attach, |
2035 | .attach = cpuset_attach, | 2034 | .attach = cpuset_attach, |
2036 | .subsys_id = cpuset_subsys_id, | ||
2037 | .base_cftypes = files, | 2035 | .base_cftypes = files, |
2038 | .early_init = 1, | 2036 | .early_init = 1, |
2039 | }; | 2037 | }; |
@@ -2699,7 +2697,7 @@ int proc_cpuset_show(struct seq_file *m, void *unused_v) | |||
2699 | goto out_free; | 2697 | goto out_free; |
2700 | 2698 | ||
2701 | rcu_read_lock(); | 2699 | rcu_read_lock(); |
2702 | css = task_css(tsk, cpuset_subsys_id); | 2700 | css = task_css(tsk, cpuset_cgrp_id); |
2703 | retval = cgroup_path(css->cgroup, buf, PAGE_SIZE); | 2701 | retval = cgroup_path(css->cgroup, buf, PAGE_SIZE); |
2704 | rcu_read_unlock(); | 2702 | rcu_read_unlock(); |
2705 | if (retval < 0) | 2703 | if (retval < 0) |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 56003c6edfd3..64903731d834 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -342,7 +342,7 @@ struct perf_cgroup { | |||
342 | static inline struct perf_cgroup * | 342 | static inline struct perf_cgroup * |
343 | perf_cgroup_from_task(struct task_struct *task) | 343 | perf_cgroup_from_task(struct task_struct *task) |
344 | { | 344 | { |
345 | return container_of(task_css(task, perf_subsys_id), | 345 | return container_of(task_css(task, perf_event_cgrp_id), |
346 | struct perf_cgroup, css); | 346 | struct perf_cgroup, css); |
347 | } | 347 | } |
348 | 348 | ||
@@ -595,7 +595,7 @@ static inline int perf_cgroup_connect(int fd, struct perf_event *event, | |||
595 | 595 | ||
596 | rcu_read_lock(); | 596 | rcu_read_lock(); |
597 | 597 | ||
598 | css = css_from_dir(f.file->f_dentry, &perf_subsys); | 598 | css = css_from_dir(f.file->f_dentry, &perf_event_cgrp_subsys); |
599 | if (IS_ERR(css)) { | 599 | if (IS_ERR(css)) { |
600 | ret = PTR_ERR(css); | 600 | ret = PTR_ERR(css); |
601 | goto out; | 601 | goto out; |
@@ -8055,9 +8055,7 @@ static void perf_cgroup_exit(struct cgroup_subsys_state *css, | |||
8055 | task_function_call(task, __perf_cgroup_move, task); | 8055 | task_function_call(task, __perf_cgroup_move, task); |
8056 | } | 8056 | } |
8057 | 8057 | ||
8058 | struct cgroup_subsys perf_subsys = { | 8058 | struct cgroup_subsys perf_event_cgrp_subsys = { |
8059 | .name = "perf_event", | ||
8060 | .subsys_id = perf_subsys_id, | ||
8061 | .css_alloc = perf_cgroup_css_alloc, | 8059 | .css_alloc = perf_cgroup_css_alloc, |
8062 | .css_free = perf_cgroup_css_free, | 8060 | .css_free = perf_cgroup_css_free, |
8063 | .exit = perf_cgroup_exit, | 8061 | .exit = perf_cgroup_exit, |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index b46131ef6aab..d4cfc5561830 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -7176,7 +7176,7 @@ void sched_move_task(struct task_struct *tsk) | |||
7176 | if (unlikely(running)) | 7176 | if (unlikely(running)) |
7177 | tsk->sched_class->put_prev_task(rq, tsk); | 7177 | tsk->sched_class->put_prev_task(rq, tsk); |
7178 | 7178 | ||
7179 | tg = container_of(task_css_check(tsk, cpu_cgroup_subsys_id, | 7179 | tg = container_of(task_css_check(tsk, cpu_cgrp_id, |
7180 | lockdep_is_held(&tsk->sighand->siglock)), | 7180 | lockdep_is_held(&tsk->sighand->siglock)), |
7181 | struct task_group, css); | 7181 | struct task_group, css); |
7182 | tg = autogroup_task_group(tsk, tg); | 7182 | tg = autogroup_task_group(tsk, tg); |
@@ -7957,8 +7957,7 @@ static struct cftype cpu_files[] = { | |||
7957 | { } /* terminate */ | 7957 | { } /* terminate */ |
7958 | }; | 7958 | }; |
7959 | 7959 | ||
7960 | struct cgroup_subsys cpu_cgroup_subsys = { | 7960 | struct cgroup_subsys cpu_cgrp_subsys = { |
7961 | .name = "cpu", | ||
7962 | .css_alloc = cpu_cgroup_css_alloc, | 7961 | .css_alloc = cpu_cgroup_css_alloc, |
7963 | .css_free = cpu_cgroup_css_free, | 7962 | .css_free = cpu_cgroup_css_free, |
7964 | .css_online = cpu_cgroup_css_online, | 7963 | .css_online = cpu_cgroup_css_online, |
@@ -7966,7 +7965,6 @@ struct cgroup_subsys cpu_cgroup_subsys = { | |||
7966 | .can_attach = cpu_cgroup_can_attach, | 7965 | .can_attach = cpu_cgroup_can_attach, |
7967 | .attach = cpu_cgroup_attach, | 7966 | .attach = cpu_cgroup_attach, |
7968 | .exit = cpu_cgroup_exit, | 7967 | .exit = cpu_cgroup_exit, |
7969 | .subsys_id = cpu_cgroup_subsys_id, | ||
7970 | .base_cftypes = cpu_files, | 7968 | .base_cftypes = cpu_files, |
7971 | .early_init = 1, | 7969 | .early_init = 1, |
7972 | }; | 7970 | }; |
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index 622e0818f905..c143ee380e3a 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c | |||
@@ -41,7 +41,7 @@ static inline struct cpuacct *css_ca(struct cgroup_subsys_state *css) | |||
41 | /* return cpu accounting group to which this task belongs */ | 41 | /* return cpu accounting group to which this task belongs */ |
42 | static inline struct cpuacct *task_ca(struct task_struct *tsk) | 42 | static inline struct cpuacct *task_ca(struct task_struct *tsk) |
43 | { | 43 | { |
44 | return css_ca(task_css(tsk, cpuacct_subsys_id)); | 44 | return css_ca(task_css(tsk, cpuacct_cgrp_id)); |
45 | } | 45 | } |
46 | 46 | ||
47 | static inline struct cpuacct *parent_ca(struct cpuacct *ca) | 47 | static inline struct cpuacct *parent_ca(struct cpuacct *ca) |
@@ -275,11 +275,9 @@ void cpuacct_account_field(struct task_struct *p, int index, u64 val) | |||
275 | rcu_read_unlock(); | 275 | rcu_read_unlock(); |
276 | } | 276 | } |
277 | 277 | ||
278 | struct cgroup_subsys cpuacct_subsys = { | 278 | struct cgroup_subsys cpuacct_cgrp_subsys = { |
279 | .name = "cpuacct", | ||
280 | .css_alloc = cpuacct_css_alloc, | 279 | .css_alloc = cpuacct_css_alloc, |
281 | .css_free = cpuacct_css_free, | 280 | .css_free = cpuacct_css_free, |
282 | .subsys_id = cpuacct_subsys_id, | ||
283 | .base_cftypes = files, | 281 | .base_cftypes = files, |
284 | .early_init = 1, | 282 | .early_init = 1, |
285 | }; | 283 | }; |
diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index cb00829bb466..b135853e68f3 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c | |||
@@ -30,7 +30,6 @@ struct hugetlb_cgroup { | |||
30 | #define MEMFILE_IDX(val) (((val) >> 16) & 0xffff) | 30 | #define MEMFILE_IDX(val) (((val) >> 16) & 0xffff) |
31 | #define MEMFILE_ATTR(val) ((val) & 0xffff) | 31 | #define MEMFILE_ATTR(val) ((val) & 0xffff) |
32 | 32 | ||
33 | struct cgroup_subsys hugetlb_subsys __read_mostly; | ||
34 | static struct hugetlb_cgroup *root_h_cgroup __read_mostly; | 33 | static struct hugetlb_cgroup *root_h_cgroup __read_mostly; |
35 | 34 | ||
36 | static inline | 35 | static inline |
@@ -42,7 +41,7 @@ struct hugetlb_cgroup *hugetlb_cgroup_from_css(struct cgroup_subsys_state *s) | |||
42 | static inline | 41 | static inline |
43 | struct hugetlb_cgroup *hugetlb_cgroup_from_task(struct task_struct *task) | 42 | struct hugetlb_cgroup *hugetlb_cgroup_from_task(struct task_struct *task) |
44 | { | 43 | { |
45 | return hugetlb_cgroup_from_css(task_css(task, hugetlb_subsys_id)); | 44 | return hugetlb_cgroup_from_css(task_css(task, hugetlb_cgrp_id)); |
46 | } | 45 | } |
47 | 46 | ||
48 | static inline bool hugetlb_cgroup_is_root(struct hugetlb_cgroup *h_cg) | 47 | static inline bool hugetlb_cgroup_is_root(struct hugetlb_cgroup *h_cg) |
@@ -358,7 +357,7 @@ static void __init __hugetlb_cgroup_file_init(int idx) | |||
358 | cft = &h->cgroup_files[4]; | 357 | cft = &h->cgroup_files[4]; |
359 | memset(cft, 0, sizeof(*cft)); | 358 | memset(cft, 0, sizeof(*cft)); |
360 | 359 | ||
361 | WARN_ON(cgroup_add_cftypes(&hugetlb_subsys, h->cgroup_files)); | 360 | WARN_ON(cgroup_add_cftypes(&hugetlb_cgrp_subsys, h->cgroup_files)); |
362 | 361 | ||
363 | return; | 362 | return; |
364 | } | 363 | } |
@@ -402,10 +401,8 @@ void hugetlb_cgroup_migrate(struct page *oldhpage, struct page *newhpage) | |||
402 | return; | 401 | return; |
403 | } | 402 | } |
404 | 403 | ||
405 | struct cgroup_subsys hugetlb_subsys = { | 404 | struct cgroup_subsys hugetlb_cgrp_subsys = { |
406 | .name = "hugetlb", | ||
407 | .css_alloc = hugetlb_cgroup_css_alloc, | 405 | .css_alloc = hugetlb_cgroup_css_alloc, |
408 | .css_offline = hugetlb_cgroup_css_offline, | 406 | .css_offline = hugetlb_cgroup_css_offline, |
409 | .css_free = hugetlb_cgroup_css_free, | 407 | .css_free = hugetlb_cgroup_css_free, |
410 | .subsys_id = hugetlb_subsys_id, | ||
411 | }; | 408 | }; |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 53385cd4e6f0..04a97bce2270 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -66,8 +66,8 @@ | |||
66 | 66 | ||
67 | #include <trace/events/vmscan.h> | 67 | #include <trace/events/vmscan.h> |
68 | 68 | ||
69 | struct cgroup_subsys mem_cgroup_subsys __read_mostly; | 69 | struct cgroup_subsys memory_cgrp_subsys __read_mostly; |
70 | EXPORT_SYMBOL(mem_cgroup_subsys); | 70 | EXPORT_SYMBOL(memory_cgrp_subsys); |
71 | 71 | ||
72 | #define MEM_CGROUP_RECLAIM_RETRIES 5 | 72 | #define MEM_CGROUP_RECLAIM_RETRIES 5 |
73 | static struct mem_cgroup *root_mem_cgroup __read_mostly; | 73 | static struct mem_cgroup *root_mem_cgroup __read_mostly; |
@@ -538,7 +538,7 @@ static inline struct mem_cgroup *mem_cgroup_from_id(unsigned short id) | |||
538 | { | 538 | { |
539 | struct cgroup_subsys_state *css; | 539 | struct cgroup_subsys_state *css; |
540 | 540 | ||
541 | css = css_from_id(id - 1, &mem_cgroup_subsys); | 541 | css = css_from_id(id - 1, &memory_cgrp_subsys); |
542 | return mem_cgroup_from_css(css); | 542 | return mem_cgroup_from_css(css); |
543 | } | 543 | } |
544 | 544 | ||
@@ -1072,7 +1072,7 @@ struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p) | |||
1072 | if (unlikely(!p)) | 1072 | if (unlikely(!p)) |
1073 | return NULL; | 1073 | return NULL; |
1074 | 1074 | ||
1075 | return mem_cgroup_from_css(task_css(p, mem_cgroup_subsys_id)); | 1075 | return mem_cgroup_from_css(task_css(p, memory_cgrp_id)); |
1076 | } | 1076 | } |
1077 | 1077 | ||
1078 | struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm) | 1078 | struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm) |
@@ -1702,7 +1702,7 @@ void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
1702 | rcu_read_lock(); | 1702 | rcu_read_lock(); |
1703 | 1703 | ||
1704 | mem_cgrp = memcg->css.cgroup; | 1704 | mem_cgrp = memcg->css.cgroup; |
1705 | task_cgrp = task_cgroup(p, mem_cgroup_subsys_id); | 1705 | task_cgrp = task_cgroup(p, memory_cgrp_id); |
1706 | 1706 | ||
1707 | ret = cgroup_path(task_cgrp, memcg_name, PATH_MAX); | 1707 | ret = cgroup_path(task_cgrp, memcg_name, PATH_MAX); |
1708 | if (ret < 0) { | 1708 | if (ret < 0) { |
@@ -6187,7 +6187,7 @@ static int memcg_write_event_control(struct cgroup_subsys_state *css, | |||
6187 | 6187 | ||
6188 | ret = -EINVAL; | 6188 | ret = -EINVAL; |
6189 | cfile_css = css_from_dir(cfile.file->f_dentry->d_parent, | 6189 | cfile_css = css_from_dir(cfile.file->f_dentry->d_parent, |
6190 | &mem_cgroup_subsys); | 6190 | &memory_cgrp_subsys); |
6191 | if (cfile_css == css && css_tryget(css)) | 6191 | if (cfile_css == css && css_tryget(css)) |
6192 | ret = 0; | 6192 | ret = 0; |
6193 | 6193 | ||
@@ -6566,11 +6566,11 @@ mem_cgroup_css_online(struct cgroup_subsys_state *css) | |||
6566 | * unfortunate state in our controller. | 6566 | * unfortunate state in our controller. |
6567 | */ | 6567 | */ |
6568 | if (parent != root_mem_cgroup) | 6568 | if (parent != root_mem_cgroup) |
6569 | mem_cgroup_subsys.broken_hierarchy = true; | 6569 | memory_cgrp_subsys.broken_hierarchy = true; |
6570 | } | 6570 | } |
6571 | mutex_unlock(&memcg_create_mutex); | 6571 | mutex_unlock(&memcg_create_mutex); |
6572 | 6572 | ||
6573 | return memcg_init_kmem(memcg, &mem_cgroup_subsys); | 6573 | return memcg_init_kmem(memcg, &memory_cgrp_subsys); |
6574 | } | 6574 | } |
6575 | 6575 | ||
6576 | /* | 6576 | /* |
@@ -7264,9 +7264,7 @@ static void mem_cgroup_bind(struct cgroup_subsys_state *root_css) | |||
7264 | mem_cgroup_from_css(root_css)->use_hierarchy = true; | 7264 | mem_cgroup_from_css(root_css)->use_hierarchy = true; |
7265 | } | 7265 | } |
7266 | 7266 | ||
7267 | struct cgroup_subsys mem_cgroup_subsys = { | 7267 | struct cgroup_subsys memory_cgrp_subsys = { |
7268 | .name = "memory", | ||
7269 | .subsys_id = mem_cgroup_subsys_id, | ||
7270 | .css_alloc = mem_cgroup_css_alloc, | 7268 | .css_alloc = mem_cgroup_css_alloc, |
7271 | .css_online = mem_cgroup_css_online, | 7269 | .css_online = mem_cgroup_css_online, |
7272 | .css_offline = mem_cgroup_css_offline, | 7270 | .css_offline = mem_cgroup_css_offline, |
@@ -7292,7 +7290,7 @@ __setup("swapaccount=", enable_swap_account); | |||
7292 | 7290 | ||
7293 | static void __init memsw_file_init(void) | 7291 | static void __init memsw_file_init(void) |
7294 | { | 7292 | { |
7295 | WARN_ON(cgroup_add_cftypes(&mem_cgroup_subsys, memsw_cgroup_files)); | 7293 | WARN_ON(cgroup_add_cftypes(&memory_cgrp_subsys, memsw_cgroup_files)); |
7296 | } | 7294 | } |
7297 | 7295 | ||
7298 | static void __init enable_swap_cgroup(void) | 7296 | static void __init enable_swap_cgroup(void) |
diff --git a/net/core/netclassid_cgroup.c b/net/core/netclassid_cgroup.c index 9e5ad5d74e60..b865662fba71 100644 --- a/net/core/netclassid_cgroup.c +++ b/net/core/netclassid_cgroup.c | |||
@@ -23,7 +23,7 @@ static inline struct cgroup_cls_state *css_cls_state(struct cgroup_subsys_state | |||
23 | 23 | ||
24 | struct cgroup_cls_state *task_cls_state(struct task_struct *p) | 24 | struct cgroup_cls_state *task_cls_state(struct task_struct *p) |
25 | { | 25 | { |
26 | return css_cls_state(task_css(p, net_cls_subsys_id)); | 26 | return css_cls_state(task_css(p, net_cls_cgrp_id)); |
27 | } | 27 | } |
28 | EXPORT_SYMBOL_GPL(task_cls_state); | 28 | EXPORT_SYMBOL_GPL(task_cls_state); |
29 | 29 | ||
@@ -102,12 +102,10 @@ static struct cftype ss_files[] = { | |||
102 | { } /* terminate */ | 102 | { } /* terminate */ |
103 | }; | 103 | }; |
104 | 104 | ||
105 | struct cgroup_subsys net_cls_subsys = { | 105 | struct cgroup_subsys net_cls_cgrp_subsys = { |
106 | .name = "net_cls", | ||
107 | .css_alloc = cgrp_css_alloc, | 106 | .css_alloc = cgrp_css_alloc, |
108 | .css_online = cgrp_css_online, | 107 | .css_online = cgrp_css_online, |
109 | .css_free = cgrp_css_free, | 108 | .css_free = cgrp_css_free, |
110 | .attach = cgrp_attach, | 109 | .attach = cgrp_attach, |
111 | .subsys_id = net_cls_subsys_id, | ||
112 | .base_cftypes = ss_files, | 110 | .base_cftypes = ss_files, |
113 | }; | 111 | }; |
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c index 857e1603f9b7..d7d23e28fafd 100644 --- a/net/core/netprio_cgroup.c +++ b/net/core/netprio_cgroup.c | |||
@@ -244,13 +244,11 @@ static struct cftype ss_files[] = { | |||
244 | { } /* terminate */ | 244 | { } /* terminate */ |
245 | }; | 245 | }; |
246 | 246 | ||
247 | struct cgroup_subsys net_prio_subsys = { | 247 | struct cgroup_subsys net_prio_cgrp_subsys = { |
248 | .name = "net_prio", | ||
249 | .css_alloc = cgrp_css_alloc, | 248 | .css_alloc = cgrp_css_alloc, |
250 | .css_online = cgrp_css_online, | 249 | .css_online = cgrp_css_online, |
251 | .css_free = cgrp_css_free, | 250 | .css_free = cgrp_css_free, |
252 | .attach = net_prio_attach, | 251 | .attach = net_prio_attach, |
253 | .subsys_id = net_prio_subsys_id, | ||
254 | .base_cftypes = ss_files, | 252 | .base_cftypes = ss_files, |
255 | }; | 253 | }; |
256 | 254 | ||
diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c index f7e522c558ba..20a0aca9131e 100644 --- a/net/ipv4/tcp_memcontrol.c +++ b/net/ipv4/tcp_memcontrol.c | |||
@@ -219,7 +219,7 @@ static struct cftype tcp_files[] = { | |||
219 | 219 | ||
220 | static int __init tcp_memcontrol_init(void) | 220 | static int __init tcp_memcontrol_init(void) |
221 | { | 221 | { |
222 | WARN_ON(cgroup_add_cftypes(&mem_cgroup_subsys, tcp_files)); | 222 | WARN_ON(cgroup_add_cftypes(&memory_cgrp_subsys, tcp_files)); |
223 | return 0; | 223 | return 0; |
224 | } | 224 | } |
225 | __initcall(tcp_memcontrol_init); | 225 | __initcall(tcp_memcontrol_init); |
diff --git a/security/device_cgroup.c b/security/device_cgroup.c index d3b6d2cd3a06..7f88bcde7c61 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c | |||
@@ -58,11 +58,9 @@ static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s) | |||
58 | 58 | ||
59 | static inline struct dev_cgroup *task_devcgroup(struct task_struct *task) | 59 | static inline struct dev_cgroup *task_devcgroup(struct task_struct *task) |
60 | { | 60 | { |
61 | return css_to_devcgroup(task_css(task, devices_subsys_id)); | 61 | return css_to_devcgroup(task_css(task, devices_cgrp_id)); |
62 | } | 62 | } |
63 | 63 | ||
64 | struct cgroup_subsys devices_subsys; | ||
65 | |||
66 | /* | 64 | /* |
67 | * called under devcgroup_mutex | 65 | * called under devcgroup_mutex |
68 | */ | 66 | */ |
@@ -684,13 +682,11 @@ static struct cftype dev_cgroup_files[] = { | |||
684 | { } /* terminate */ | 682 | { } /* terminate */ |
685 | }; | 683 | }; |
686 | 684 | ||
687 | struct cgroup_subsys devices_subsys = { | 685 | struct cgroup_subsys devices_cgrp_subsys = { |
688 | .name = "devices", | ||
689 | .css_alloc = devcgroup_css_alloc, | 686 | .css_alloc = devcgroup_css_alloc, |
690 | .css_free = devcgroup_css_free, | 687 | .css_free = devcgroup_css_free, |
691 | .css_online = devcgroup_online, | 688 | .css_online = devcgroup_online, |
692 | .css_offline = devcgroup_offline, | 689 | .css_offline = devcgroup_offline, |
693 | .subsys_id = devices_subsys_id, | ||
694 | .base_cftypes = dev_cgroup_files, | 690 | .base_cftypes = dev_cgroup_files, |
695 | }; | 691 | }; |
696 | 692 | ||