aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup.c34
-rw-r--r--kernel/cgroup_freezer.c8
-rw-r--r--kernel/cpuset.c10
-rw-r--r--kernel/events/core.c8
-rw-r--r--kernel/sched/core.c6
-rw-r--r--kernel/sched/cpuacct.c6
6 files changed, 33 insertions, 39 deletions
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;
120static struct workqueue_struct *cgroup_pidlist_destroy_wq; 120static 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,
124static struct cgroup_subsys *cgroup_subsys[] = { 124static 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,
131static 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
5170struct cgroup_subsys debug_subsys = { 5178struct 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
53static inline struct freezer *task_freezer(struct task_struct *task) 53static 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
58static struct freezer *parent_freezer(struct freezer *freezer) 58static 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
87struct cgroup_subsys freezer_subsys;
88
89static struct cgroup_subsys_state * 87static struct cgroup_subsys_state *
90freezer_css_alloc(struct cgroup_subsys_state *parent_css) 88freezer_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
476struct cgroup_subsys freezer_subsys = { 474struct 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 */
120static inline struct cpuset *task_cs(struct task_struct *task) 120static 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
125static inline struct cpuset *parent_cs(struct cpuset *cs) 125static 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
2027struct cgroup_subsys cpuset_subsys = { 2027struct 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 {
342static inline struct perf_cgroup * 342static inline struct perf_cgroup *
343perf_cgroup_from_task(struct task_struct *task) 343perf_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
8058struct cgroup_subsys perf_subsys = { 8058struct 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
7960struct cgroup_subsys cpu_cgroup_subsys = { 7960struct 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 */
42static inline struct cpuacct *task_ca(struct task_struct *tsk) 42static 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
47static inline struct cpuacct *parent_ca(struct cpuacct *ca) 47static 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
278struct cgroup_subsys cpuacct_subsys = { 278struct 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};