diff options
author | Tejun Heo <tj@kernel.org> | 2013-06-24 18:21:47 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-06-24 18:21:47 -0400 |
commit | 9871bf9550d25e488cd2f0ce958d3f59f17fa720 (patch) | |
tree | de3604abd257f7c04aaab44af07665ac68569bed /kernel | |
parent | 02c402d98588bdfd3bebd267db574e13afdef722 (diff) |
cgroup: prefix global variables with "cgroup_"
Global variable names in kernel/cgroup.c are asking for trouble -
subsys, roots, rootnode and so on. Rename them to have "cgroup_"
prefix.
* s/subsys/cgroup_subsys/
* s/rootnode/cgroup_dummy_root/
* s/dummytop/cgroup_cummy_top/
* s/roots/cgroup_roots/
* s/root_count/cgroup_root_count/
This patch is purely cosmetic.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cgroup.c | 153 |
1 files changed, 77 insertions, 76 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 1051c1f69674..8f296b83b6a3 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -96,16 +96,19 @@ static DEFINE_MUTEX(cgroup_root_mutex); | |||
96 | */ | 96 | */ |
97 | #define SUBSYS(_x) [_x ## _subsys_id] = &_x ## _subsys, | 97 | #define SUBSYS(_x) [_x ## _subsys_id] = &_x ## _subsys, |
98 | #define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option) | 98 | #define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option) |
99 | static struct cgroup_subsys *subsys[CGROUP_SUBSYS_COUNT] = { | 99 | static struct cgroup_subsys *cgroup_subsys[CGROUP_SUBSYS_COUNT] = { |
100 | #include <linux/cgroup_subsys.h> | 100 | #include <linux/cgroup_subsys.h> |
101 | }; | 101 | }; |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * The "rootnode" hierarchy is the "dummy hierarchy", reserved for the | 104 | * The dummy hierarchy, reserved for the subsystems that are otherwise |
105 | * subsystems that are otherwise unattached - it never has more than a | 105 | * unattached - it never has more than a single cgroup, and all tasks are |
106 | * single cgroup, and all tasks are part of that cgroup. | 106 | * part of that cgroup. |
107 | */ | 107 | */ |
108 | static struct cgroupfs_root rootnode; | 108 | static struct cgroupfs_root cgroup_dummy_root; |
109 | |||
110 | /* dummy_top is a shorthand for the dummy hierarchy's top cgroup */ | ||
111 | static struct cgroup * const cgroup_dummy_top = &cgroup_dummy_root.top_cgroup; | ||
109 | 112 | ||
110 | /* | 113 | /* |
111 | * cgroupfs file entry, pointed to from leaf dentry->d_fsdata. | 114 | * cgroupfs file entry, pointed to from leaf dentry->d_fsdata. |
@@ -183,8 +186,8 @@ struct cgroup_event { | |||
183 | 186 | ||
184 | /* The list of hierarchy roots */ | 187 | /* The list of hierarchy roots */ |
185 | 188 | ||
186 | static LIST_HEAD(roots); | 189 | static LIST_HEAD(cgroup_roots); |
187 | static int root_count; | 190 | static int cgroup_root_count; |
188 | 191 | ||
189 | /* | 192 | /* |
190 | * Hierarchy ID allocation and mapping. It follows the same exclusion | 193 | * Hierarchy ID allocation and mapping. It follows the same exclusion |
@@ -193,9 +196,6 @@ static int root_count; | |||
193 | */ | 196 | */ |
194 | static DEFINE_IDR(cgroup_hierarchy_idr); | 197 | static DEFINE_IDR(cgroup_hierarchy_idr); |
195 | 198 | ||
196 | /* dummytop is a shorthand for the dummy hierarchy's top cgroup */ | ||
197 | #define dummytop (&rootnode.top_cgroup) | ||
198 | |||
199 | static struct cgroup_name root_cgroup_name = { .name = "/" }; | 199 | static struct cgroup_name root_cgroup_name = { .name = "/" }; |
200 | 200 | ||
201 | /* | 201 | /* |
@@ -268,7 +268,7 @@ list_for_each_entry(_ss, &_root->subsys_list, sibling) | |||
268 | 268 | ||
269 | /* for_each_active_root() allows you to iterate across the active hierarchies */ | 269 | /* for_each_active_root() allows you to iterate across the active hierarchies */ |
270 | #define for_each_active_root(_root) \ | 270 | #define for_each_active_root(_root) \ |
271 | list_for_each_entry(_root, &roots, root_list) | 271 | list_for_each_entry(_root, &cgroup_roots, root_list) |
272 | 272 | ||
273 | static inline struct cgroup *__d_cgrp(struct dentry *dentry) | 273 | static inline struct cgroup *__d_cgrp(struct dentry *dentry) |
274 | { | 274 | { |
@@ -650,7 +650,7 @@ static struct css_set *find_css_set(struct css_set *old_cset, | |||
650 | return NULL; | 650 | return NULL; |
651 | 651 | ||
652 | /* Allocate all the cgrp_cset_link objects that we'll need */ | 652 | /* Allocate all the cgrp_cset_link objects that we'll need */ |
653 | if (allocate_cgrp_cset_links(root_count, &tmp_links) < 0) { | 653 | if (allocate_cgrp_cset_links(cgroup_root_count, &tmp_links) < 0) { |
654 | kfree(cset); | 654 | kfree(cset); |
655 | return NULL; | 655 | return NULL; |
656 | } | 656 | } |
@@ -1000,7 +1000,7 @@ static int rebind_subsystems(struct cgroupfs_root *root, | |||
1000 | /* Check that any added subsystems are currently free */ | 1000 | /* Check that any added subsystems are currently free */ |
1001 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | 1001 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { |
1002 | unsigned long bit = 1UL << i; | 1002 | unsigned long bit = 1UL << i; |
1003 | struct cgroup_subsys *ss = subsys[i]; | 1003 | struct cgroup_subsys *ss = cgroup_subsys[i]; |
1004 | if (!(bit & added_mask)) | 1004 | if (!(bit & added_mask)) |
1005 | continue; | 1005 | continue; |
1006 | /* | 1006 | /* |
@@ -1009,7 +1009,7 @@ static int rebind_subsystems(struct cgroupfs_root *root, | |||
1009 | * ensure that subsystems won't disappear once selected. | 1009 | * ensure that subsystems won't disappear once selected. |
1010 | */ | 1010 | */ |
1011 | BUG_ON(ss == NULL); | 1011 | BUG_ON(ss == NULL); |
1012 | if (ss->root != &rootnode) { | 1012 | if (ss->root != &cgroup_dummy_root) { |
1013 | /* Subsystem isn't free */ | 1013 | /* Subsystem isn't free */ |
1014 | return -EBUSY; | 1014 | return -EBUSY; |
1015 | } | 1015 | } |
@@ -1024,15 +1024,15 @@ static int rebind_subsystems(struct cgroupfs_root *root, | |||
1024 | 1024 | ||
1025 | /* Process each subsystem */ | 1025 | /* Process each subsystem */ |
1026 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | 1026 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { |
1027 | struct cgroup_subsys *ss = subsys[i]; | 1027 | struct cgroup_subsys *ss = cgroup_subsys[i]; |
1028 | unsigned long bit = 1UL << i; | 1028 | unsigned long bit = 1UL << i; |
1029 | if (bit & added_mask) { | 1029 | if (bit & added_mask) { |
1030 | /* We're binding this subsystem to this hierarchy */ | 1030 | /* We're binding this subsystem to this hierarchy */ |
1031 | BUG_ON(ss == NULL); | 1031 | BUG_ON(ss == NULL); |
1032 | BUG_ON(cgrp->subsys[i]); | 1032 | BUG_ON(cgrp->subsys[i]); |
1033 | BUG_ON(!dummytop->subsys[i]); | 1033 | BUG_ON(!cgroup_dummy_top->subsys[i]); |
1034 | BUG_ON(dummytop->subsys[i]->cgroup != dummytop); | 1034 | BUG_ON(cgroup_dummy_top->subsys[i]->cgroup != cgroup_dummy_top); |
1035 | cgrp->subsys[i] = dummytop->subsys[i]; | 1035 | cgrp->subsys[i] = cgroup_dummy_top->subsys[i]; |
1036 | cgrp->subsys[i]->cgroup = cgrp; | 1036 | cgrp->subsys[i]->cgroup = cgrp; |
1037 | list_move(&ss->sibling, &root->subsys_list); | 1037 | list_move(&ss->sibling, &root->subsys_list); |
1038 | ss->root = root; | 1038 | ss->root = root; |
@@ -1042,14 +1042,14 @@ static int rebind_subsystems(struct cgroupfs_root *root, | |||
1042 | } else if (bit & removed_mask) { | 1042 | } else if (bit & removed_mask) { |
1043 | /* We're removing this subsystem */ | 1043 | /* We're removing this subsystem */ |
1044 | BUG_ON(ss == NULL); | 1044 | BUG_ON(ss == NULL); |
1045 | BUG_ON(cgrp->subsys[i] != dummytop->subsys[i]); | 1045 | BUG_ON(cgrp->subsys[i] != cgroup_dummy_top->subsys[i]); |
1046 | BUG_ON(cgrp->subsys[i]->cgroup != cgrp); | 1046 | BUG_ON(cgrp->subsys[i]->cgroup != cgrp); |
1047 | if (ss->bind) | 1047 | if (ss->bind) |
1048 | ss->bind(dummytop); | 1048 | ss->bind(cgroup_dummy_top); |
1049 | dummytop->subsys[i]->cgroup = dummytop; | 1049 | cgroup_dummy_top->subsys[i]->cgroup = cgroup_dummy_top; |
1050 | cgrp->subsys[i] = NULL; | 1050 | cgrp->subsys[i] = NULL; |
1051 | subsys[i]->root = &rootnode; | 1051 | cgroup_subsys[i]->root = &cgroup_dummy_root; |
1052 | list_move(&ss->sibling, &rootnode.subsys_list); | 1052 | list_move(&ss->sibling, &cgroup_dummy_root.subsys_list); |
1053 | /* subsystem is now free - drop reference on module */ | 1053 | /* subsystem is now free - drop reference on module */ |
1054 | module_put(ss->module); | 1054 | module_put(ss->module); |
1055 | } else if (bit & final_subsys_mask) { | 1055 | } else if (bit & final_subsys_mask) { |
@@ -1112,10 +1112,10 @@ struct cgroup_sb_opts { | |||
1112 | }; | 1112 | }; |
1113 | 1113 | ||
1114 | /* | 1114 | /* |
1115 | * Convert a hierarchy specifier into a bitmask of subsystems and flags. Call | 1115 | * Convert a hierarchy specifier into a bitmask of subsystems and |
1116 | * with cgroup_mutex held to protect the subsys[] array. This function takes | 1116 | * flags. Call with cgroup_mutex held to protect the cgroup_subsys[] |
1117 | * refcounts on subsystems to be used, unless it returns error, in which case | 1117 | * array. This function takes refcounts on subsystems to be used, unless it |
1118 | * no refcounts are taken. | 1118 | * returns error, in which case no refcounts are taken. |
1119 | */ | 1119 | */ |
1120 | static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts) | 1120 | static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts) |
1121 | { | 1121 | { |
@@ -1201,7 +1201,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts) | |||
1201 | } | 1201 | } |
1202 | 1202 | ||
1203 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | 1203 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { |
1204 | struct cgroup_subsys *ss = subsys[i]; | 1204 | struct cgroup_subsys *ss = cgroup_subsys[i]; |
1205 | if (ss == NULL) | 1205 | if (ss == NULL) |
1206 | continue; | 1206 | continue; |
1207 | if (strcmp(token, ss->name)) | 1207 | if (strcmp(token, ss->name)) |
@@ -1228,7 +1228,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts) | |||
1228 | */ | 1228 | */ |
1229 | if (all_ss || (!one_ss && !opts->none && !opts->name)) { | 1229 | if (all_ss || (!one_ss && !opts->none && !opts->name)) { |
1230 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | 1230 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { |
1231 | struct cgroup_subsys *ss = subsys[i]; | 1231 | struct cgroup_subsys *ss = cgroup_subsys[i]; |
1232 | if (ss == NULL) | 1232 | if (ss == NULL) |
1233 | continue; | 1233 | continue; |
1234 | if (ss->disabled) | 1234 | if (ss->disabled) |
@@ -1284,7 +1284,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts) | |||
1284 | 1284 | ||
1285 | if (!(bit & opts->subsys_mask)) | 1285 | if (!(bit & opts->subsys_mask)) |
1286 | continue; | 1286 | continue; |
1287 | if (!try_module_get(subsys[i]->module)) { | 1287 | if (!try_module_get(cgroup_subsys[i]->module)) { |
1288 | module_pin_failed = true; | 1288 | module_pin_failed = true; |
1289 | break; | 1289 | break; |
1290 | } | 1290 | } |
@@ -1301,7 +1301,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts) | |||
1301 | 1301 | ||
1302 | if (!(bit & opts->subsys_mask)) | 1302 | if (!(bit & opts->subsys_mask)) |
1303 | continue; | 1303 | continue; |
1304 | module_put(subsys[i]->module); | 1304 | module_put(cgroup_subsys[i]->module); |
1305 | } | 1305 | } |
1306 | return -ENOENT; | 1306 | return -ENOENT; |
1307 | } | 1307 | } |
@@ -1317,7 +1317,7 @@ static void drop_parsed_module_refcounts(unsigned long subsys_mask) | |||
1317 | 1317 | ||
1318 | if (!(bit & subsys_mask)) | 1318 | if (!(bit & subsys_mask)) |
1319 | continue; | 1319 | continue; |
1320 | module_put(subsys[i]->module); | 1320 | module_put(cgroup_subsys[i]->module); |
1321 | } | 1321 | } |
1322 | } | 1322 | } |
1323 | 1323 | ||
@@ -1648,8 +1648,8 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type, | |||
1648 | /* EBUSY should be the only error here */ | 1648 | /* EBUSY should be the only error here */ |
1649 | BUG_ON(ret); | 1649 | BUG_ON(ret); |
1650 | 1650 | ||
1651 | list_add(&root->root_list, &roots); | 1651 | list_add(&root->root_list, &cgroup_roots); |
1652 | root_count++; | 1652 | cgroup_root_count++; |
1653 | 1653 | ||
1654 | sb->s_root->d_fsdata = root_cgrp; | 1654 | sb->s_root->d_fsdata = root_cgrp; |
1655 | root->top_cgroup.dentry = sb->s_root; | 1655 | root->top_cgroup.dentry = sb->s_root; |
@@ -1746,7 +1746,7 @@ static void cgroup_kill_sb(struct super_block *sb) { | |||
1746 | 1746 | ||
1747 | if (!list_empty(&root->root_list)) { | 1747 | if (!list_empty(&root->root_list)) { |
1748 | list_del(&root->root_list); | 1748 | list_del(&root->root_list); |
1749 | root_count--; | 1749 | cgroup_root_count--; |
1750 | } | 1750 | } |
1751 | 1751 | ||
1752 | cgroup_exit_root_id(root); | 1752 | cgroup_exit_root_id(root); |
@@ -2807,7 +2807,7 @@ static void cgroup_cfts_commit(struct cgroup_subsys *ss, | |||
2807 | u64 update_before; | 2807 | u64 update_before; |
2808 | 2808 | ||
2809 | /* %NULL @cfts indicates abort and don't bother if @ss isn't attached */ | 2809 | /* %NULL @cfts indicates abort and don't bother if @ss isn't attached */ |
2810 | if (!cfts || ss->root == &rootnode || | 2810 | if (!cfts || ss->root == &cgroup_dummy_root || |
2811 | !atomic_inc_not_zero(&sb->s_active)) { | 2811 | !atomic_inc_not_zero(&sb->s_active)) { |
2812 | mutex_unlock(&cgroup_mutex); | 2812 | mutex_unlock(&cgroup_mutex); |
2813 | return; | 2813 | return; |
@@ -4186,7 +4186,7 @@ static void init_cgroup_css(struct cgroup_subsys_state *css, | |||
4186 | css->cgroup = cgrp; | 4186 | css->cgroup = cgrp; |
4187 | css->flags = 0; | 4187 | css->flags = 0; |
4188 | css->id = NULL; | 4188 | css->id = NULL; |
4189 | if (cgrp == dummytop) | 4189 | if (cgrp == cgroup_dummy_top) |
4190 | css->flags |= CSS_ROOT; | 4190 | css->flags |= CSS_ROOT; |
4191 | BUG_ON(cgrp->subsys[ss->subsys_id]); | 4191 | BUG_ON(cgrp->subsys[ss->subsys_id]); |
4192 | cgrp->subsys[ss->subsys_id] = css; | 4192 | cgrp->subsys[ss->subsys_id] = css; |
@@ -4615,12 +4615,12 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss) | |||
4615 | cgroup_init_cftsets(ss); | 4615 | cgroup_init_cftsets(ss); |
4616 | 4616 | ||
4617 | /* Create the top cgroup state for this subsystem */ | 4617 | /* Create the top cgroup state for this subsystem */ |
4618 | list_add(&ss->sibling, &rootnode.subsys_list); | 4618 | list_add(&ss->sibling, &cgroup_dummy_root.subsys_list); |
4619 | ss->root = &rootnode; | 4619 | ss->root = &cgroup_dummy_root; |
4620 | css = ss->css_alloc(dummytop); | 4620 | css = ss->css_alloc(cgroup_dummy_top); |
4621 | /* We don't handle early failures gracefully */ | 4621 | /* We don't handle early failures gracefully */ |
4622 | BUG_ON(IS_ERR(css)); | 4622 | BUG_ON(IS_ERR(css)); |
4623 | init_cgroup_css(css, ss, dummytop); | 4623 | init_cgroup_css(css, ss, cgroup_dummy_top); |
4624 | 4624 | ||
4625 | /* Update the init_css_set to contain a subsys | 4625 | /* Update the init_css_set to contain a subsys |
4626 | * pointer to this state - since the subsystem is | 4626 | * pointer to this state - since the subsystem is |
@@ -4635,7 +4635,7 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss) | |||
4635 | * need to invoke fork callbacks here. */ | 4635 | * need to invoke fork callbacks here. */ |
4636 | BUG_ON(!list_empty(&init_task.tasks)); | 4636 | BUG_ON(!list_empty(&init_task.tasks)); |
4637 | 4637 | ||
4638 | BUG_ON(online_css(ss, dummytop)); | 4638 | BUG_ON(online_css(ss, cgroup_dummy_top)); |
4639 | 4639 | ||
4640 | mutex_unlock(&cgroup_mutex); | 4640 | mutex_unlock(&cgroup_mutex); |
4641 | 4641 | ||
@@ -4681,7 +4681,7 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss) | |||
4681 | */ | 4681 | */ |
4682 | if (ss->module == NULL) { | 4682 | if (ss->module == NULL) { |
4683 | /* a sanity check */ | 4683 | /* a sanity check */ |
4684 | BUG_ON(subsys[ss->subsys_id] != ss); | 4684 | BUG_ON(cgroup_subsys[ss->subsys_id] != ss); |
4685 | return 0; | 4685 | return 0; |
4686 | } | 4686 | } |
4687 | 4687 | ||
@@ -4689,26 +4689,26 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss) | |||
4689 | cgroup_init_cftsets(ss); | 4689 | cgroup_init_cftsets(ss); |
4690 | 4690 | ||
4691 | mutex_lock(&cgroup_mutex); | 4691 | mutex_lock(&cgroup_mutex); |
4692 | subsys[ss->subsys_id] = ss; | 4692 | cgroup_subsys[ss->subsys_id] = ss; |
4693 | 4693 | ||
4694 | /* | 4694 | /* |
4695 | * no ss->css_alloc seems to need anything important in the ss | 4695 | * no ss->css_alloc seems to need anything important in the ss |
4696 | * struct, so this can happen first (i.e. before the rootnode | 4696 | * struct, so this can happen first (i.e. before the dummy root |
4697 | * attachment). | 4697 | * attachment). |
4698 | */ | 4698 | */ |
4699 | css = ss->css_alloc(dummytop); | 4699 | css = ss->css_alloc(cgroup_dummy_top); |
4700 | if (IS_ERR(css)) { | 4700 | if (IS_ERR(css)) { |
4701 | /* failure case - need to deassign the subsys[] slot. */ | 4701 | /* failure case - need to deassign the cgroup_subsys[] slot. */ |
4702 | subsys[ss->subsys_id] = NULL; | 4702 | cgroup_subsys[ss->subsys_id] = NULL; |
4703 | mutex_unlock(&cgroup_mutex); | 4703 | mutex_unlock(&cgroup_mutex); |
4704 | return PTR_ERR(css); | 4704 | return PTR_ERR(css); |
4705 | } | 4705 | } |
4706 | 4706 | ||
4707 | list_add(&ss->sibling, &rootnode.subsys_list); | 4707 | list_add(&ss->sibling, &cgroup_dummy_root.subsys_list); |
4708 | ss->root = &rootnode; | 4708 | ss->root = &cgroup_dummy_root; |
4709 | 4709 | ||
4710 | /* our new subsystem will be attached to the dummy hierarchy. */ | 4710 | /* our new subsystem will be attached to the dummy hierarchy. */ |
4711 | init_cgroup_css(css, ss, dummytop); | 4711 | init_cgroup_css(css, ss, cgroup_dummy_top); |
4712 | /* init_idr must be after init_cgroup_css because it sets css->id. */ | 4712 | /* init_idr must be after init_cgroup_css because it sets css->id. */ |
4713 | if (ss->use_id) { | 4713 | if (ss->use_id) { |
4714 | ret = cgroup_init_idr(ss, css); | 4714 | ret = cgroup_init_idr(ss, css); |
@@ -4739,7 +4739,7 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss) | |||
4739 | } | 4739 | } |
4740 | write_unlock(&css_set_lock); | 4740 | write_unlock(&css_set_lock); |
4741 | 4741 | ||
4742 | ret = online_css(ss, dummytop); | 4742 | ret = online_css(ss, cgroup_dummy_top); |
4743 | if (ret) | 4743 | if (ret) |
4744 | goto err_unload; | 4744 | goto err_unload; |
4745 | 4745 | ||
@@ -4774,27 +4774,28 @@ void cgroup_unload_subsys(struct cgroup_subsys *ss) | |||
4774 | * try_module_get in parse_cgroupfs_options should ensure that it | 4774 | * try_module_get in parse_cgroupfs_options should ensure that it |
4775 | * doesn't start being used while we're killing it off. | 4775 | * doesn't start being used while we're killing it off. |
4776 | */ | 4776 | */ |
4777 | BUG_ON(ss->root != &rootnode); | 4777 | BUG_ON(ss->root != &cgroup_dummy_root); |
4778 | 4778 | ||
4779 | mutex_lock(&cgroup_mutex); | 4779 | mutex_lock(&cgroup_mutex); |
4780 | 4780 | ||
4781 | offline_css(ss, dummytop); | 4781 | offline_css(ss, cgroup_dummy_top); |
4782 | 4782 | ||
4783 | if (ss->use_id) | 4783 | if (ss->use_id) |
4784 | idr_destroy(&ss->idr); | 4784 | idr_destroy(&ss->idr); |
4785 | 4785 | ||
4786 | /* deassign the subsys_id */ | 4786 | /* deassign the subsys_id */ |
4787 | subsys[ss->subsys_id] = NULL; | 4787 | cgroup_subsys[ss->subsys_id] = NULL; |
4788 | 4788 | ||
4789 | /* remove subsystem from rootnode's list of subsystems */ | 4789 | /* remove subsystem from the dummy root's list of subsystems */ |
4790 | list_del_init(&ss->sibling); | 4790 | list_del_init(&ss->sibling); |
4791 | 4791 | ||
4792 | /* | 4792 | /* |
4793 | * disentangle the css from all css_sets attached to the dummytop. as | 4793 | * disentangle the css from all css_sets attached to the dummy |
4794 | * in loading, we need to pay our respects to the hashtable gods. | 4794 | * top. as in loading, we need to pay our respects to the hashtable |
4795 | * gods. | ||
4795 | */ | 4796 | */ |
4796 | write_lock(&css_set_lock); | 4797 | write_lock(&css_set_lock); |
4797 | list_for_each_entry(link, &dummytop->cset_links, cset_link) { | 4798 | list_for_each_entry(link, &cgroup_dummy_top->cset_links, cset_link) { |
4798 | struct css_set *cset = link->cset; | 4799 | struct css_set *cset = link->cset; |
4799 | unsigned long key; | 4800 | unsigned long key; |
4800 | 4801 | ||
@@ -4806,13 +4807,13 @@ void cgroup_unload_subsys(struct cgroup_subsys *ss) | |||
4806 | write_unlock(&css_set_lock); | 4807 | write_unlock(&css_set_lock); |
4807 | 4808 | ||
4808 | /* | 4809 | /* |
4809 | * remove subsystem's css from the dummytop and free it - need to | 4810 | * remove subsystem's css from the cgroup_dummy_top and free it - |
4810 | * free before marking as null because ss->css_free needs the | 4811 | * need to free before marking as null because ss->css_free needs |
4811 | * cgrp->subsys pointer to find their state. note that this also | 4812 | * the cgrp->subsys pointer to find their state. note that this |
4812 | * takes care of freeing the css_id. | 4813 | * also takes care of freeing the css_id. |
4813 | */ | 4814 | */ |
4814 | ss->css_free(dummytop); | 4815 | ss->css_free(cgroup_dummy_top); |
4815 | dummytop->subsys[ss->subsys_id] = NULL; | 4816 | cgroup_dummy_top->subsys[ss->subsys_id] = NULL; |
4816 | 4817 | ||
4817 | mutex_unlock(&cgroup_mutex); | 4818 | mutex_unlock(&cgroup_mutex); |
4818 | } | 4819 | } |
@@ -4832,17 +4833,17 @@ int __init cgroup_init_early(void) | |||
4832 | INIT_LIST_HEAD(&init_css_set.tasks); | 4833 | INIT_LIST_HEAD(&init_css_set.tasks); |
4833 | INIT_HLIST_NODE(&init_css_set.hlist); | 4834 | INIT_HLIST_NODE(&init_css_set.hlist); |
4834 | css_set_count = 1; | 4835 | css_set_count = 1; |
4835 | init_cgroup_root(&rootnode); | 4836 | init_cgroup_root(&cgroup_dummy_root); |
4836 | root_count = 1; | 4837 | cgroup_root_count = 1; |
4837 | init_task.cgroups = &init_css_set; | 4838 | init_task.cgroups = &init_css_set; |
4838 | 4839 | ||
4839 | init_cgrp_cset_link.cset = &init_css_set; | 4840 | init_cgrp_cset_link.cset = &init_css_set; |
4840 | init_cgrp_cset_link.cgrp = dummytop; | 4841 | init_cgrp_cset_link.cgrp = cgroup_dummy_top; |
4841 | list_add(&init_cgrp_cset_link.cset_link, &rootnode.top_cgroup.cset_links); | 4842 | list_add(&init_cgrp_cset_link.cset_link, &cgroup_dummy_top->cset_links); |
4842 | list_add(&init_cgrp_cset_link.cgrp_link, &init_css_set.cgrp_links); | 4843 | list_add(&init_cgrp_cset_link.cgrp_link, &init_css_set.cgrp_links); |
4843 | 4844 | ||
4844 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | 4845 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { |
4845 | struct cgroup_subsys *ss = subsys[i]; | 4846 | struct cgroup_subsys *ss = cgroup_subsys[i]; |
4846 | 4847 | ||
4847 | /* at bootup time, we don't worry about modular subsystems */ | 4848 | /* at bootup time, we don't worry about modular subsystems */ |
4848 | if (!ss || ss->module) | 4849 | if (!ss || ss->module) |
@@ -4881,7 +4882,7 @@ int __init cgroup_init(void) | |||
4881 | return err; | 4882 | return err; |
4882 | 4883 | ||
4883 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | 4884 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { |
4884 | struct cgroup_subsys *ss = subsys[i]; | 4885 | struct cgroup_subsys *ss = cgroup_subsys[i]; |
4885 | 4886 | ||
4886 | /* at bootup time, we don't worry about modular subsystems */ | 4887 | /* at bootup time, we don't worry about modular subsystems */ |
4887 | if (!ss || ss->module) | 4888 | if (!ss || ss->module) |
@@ -4900,7 +4901,7 @@ int __init cgroup_init(void) | |||
4900 | mutex_lock(&cgroup_mutex); | 4901 | mutex_lock(&cgroup_mutex); |
4901 | mutex_lock(&cgroup_root_mutex); | 4902 | mutex_lock(&cgroup_root_mutex); |
4902 | 4903 | ||
4903 | BUG_ON(cgroup_init_root_id(&rootnode)); | 4904 | BUG_ON(cgroup_init_root_id(&cgroup_dummy_root)); |
4904 | 4905 | ||
4905 | mutex_unlock(&cgroup_root_mutex); | 4906 | mutex_unlock(&cgroup_root_mutex); |
4906 | mutex_unlock(&cgroup_mutex); | 4907 | mutex_unlock(&cgroup_mutex); |
@@ -5004,7 +5005,7 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v) | |||
5004 | */ | 5005 | */ |
5005 | mutex_lock(&cgroup_mutex); | 5006 | mutex_lock(&cgroup_mutex); |
5006 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | 5007 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { |
5007 | struct cgroup_subsys *ss = subsys[i]; | 5008 | struct cgroup_subsys *ss = cgroup_subsys[i]; |
5008 | if (ss == NULL) | 5009 | if (ss == NULL) |
5009 | continue; | 5010 | continue; |
5010 | seq_printf(m, "%s\t%d\t%d\t%d\n", | 5011 | seq_printf(m, "%s\t%d\t%d\t%d\n", |
@@ -5101,7 +5102,7 @@ void cgroup_post_fork(struct task_struct *child) | |||
5101 | * can't touch that. | 5102 | * can't touch that. |
5102 | */ | 5103 | */ |
5103 | for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) { | 5104 | for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) { |
5104 | struct cgroup_subsys *ss = subsys[i]; | 5105 | struct cgroup_subsys *ss = cgroup_subsys[i]; |
5105 | 5106 | ||
5106 | if (ss->fork) | 5107 | if (ss->fork) |
5107 | ss->fork(child); | 5108 | ss->fork(child); |
@@ -5172,7 +5173,7 @@ void cgroup_exit(struct task_struct *tsk, int run_callbacks) | |||
5172 | * subsystems, see cgroup_post_fork() for details. | 5173 | * subsystems, see cgroup_post_fork() for details. |
5173 | */ | 5174 | */ |
5174 | for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) { | 5175 | for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) { |
5175 | struct cgroup_subsys *ss = subsys[i]; | 5176 | struct cgroup_subsys *ss = cgroup_subsys[i]; |
5176 | 5177 | ||
5177 | if (ss->exit) { | 5178 | if (ss->exit) { |
5178 | struct cgroup *old_cgrp = | 5179 | struct cgroup *old_cgrp = |
@@ -5291,7 +5292,7 @@ static int __init cgroup_disable(char *str) | |||
5291 | if (!*token) | 5292 | if (!*token) |
5292 | continue; | 5293 | continue; |
5293 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | 5294 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { |
5294 | struct cgroup_subsys *ss = subsys[i]; | 5295 | struct cgroup_subsys *ss = cgroup_subsys[i]; |
5295 | 5296 | ||
5296 | /* | 5297 | /* |
5297 | * cgroup_disable, being at boot time, can't | 5298 | * cgroup_disable, being at boot time, can't |