Commit e5f6a8609bab0c2d7543ab1505105e011832afd7
Committed by
Linus Torvalds
1 parent
7534432dcc
Exists in
master
and in
4 other branches
cgroups: make root_list contains active hierarchies only
Don't link rootnode to the root list, so root_list contains active hierarchies only as the comment indicates. And rename for_each_root() to for_each_active_root(). Also remove redundant check in cgroup_kill_sb(). Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Cc: Paul Menage <menage@google.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Balbir Singh <balbir@in.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 7 additions and 12 deletions Side-by-side Diff
kernel/cgroup.c
... | ... | @@ -84,7 +84,7 @@ |
84 | 84 | /* Tracks how many cgroups are currently defined in hierarchy.*/ |
85 | 85 | int number_of_cgroups; |
86 | 86 | |
87 | - /* A list running through the mounted hierarchies */ | |
87 | + /* A list running through the active hierarchies */ | |
88 | 88 | struct list_head root_list; |
89 | 89 | |
90 | 90 | /* Hierarchy-specific flags */ |
... | ... | @@ -148,8 +148,8 @@ |
148 | 148 | #define for_each_subsys(_root, _ss) \ |
149 | 149 | list_for_each_entry(_ss, &_root->subsys_list, sibling) |
150 | 150 | |
151 | -/* for_each_root() allows you to iterate across the active hierarchies */ | |
152 | -#define for_each_root(_root) \ | |
151 | +/* for_each_active_root() allows you to iterate across the active hierarchies */ | |
152 | +#define for_each_active_root(_root) \ | |
153 | 153 | list_for_each_entry(_root, &roots, root_list) |
154 | 154 | |
155 | 155 | /* the list of cgroups eligible for automatic release. Protected by |
... | ... | @@ -1111,10 +1111,9 @@ |
1111 | 1111 | } |
1112 | 1112 | write_unlock(&css_set_lock); |
1113 | 1113 | |
1114 | - if (!list_empty(&root->root_list)) { | |
1115 | - list_del(&root->root_list); | |
1116 | - root_count--; | |
1117 | - } | |
1114 | + list_del(&root->root_list); | |
1115 | + root_count--; | |
1116 | + | |
1118 | 1117 | mutex_unlock(&cgroup_mutex); |
1119 | 1118 | |
1120 | 1119 | kfree(root); |
... | ... | @@ -2559,7 +2558,6 @@ |
2559 | 2558 | INIT_HLIST_NODE(&init_css_set.hlist); |
2560 | 2559 | css_set_count = 1; |
2561 | 2560 | init_cgroup_root(&rootnode); |
2562 | - list_add(&rootnode.root_list, &roots); | |
2563 | 2561 | root_count = 1; |
2564 | 2562 | init_task.cgroups = &init_css_set; |
2565 | 2563 | |
2566 | 2564 | |
... | ... | @@ -2666,15 +2664,12 @@ |
2666 | 2664 | |
2667 | 2665 | mutex_lock(&cgroup_mutex); |
2668 | 2666 | |
2669 | - for_each_root(root) { | |
2667 | + for_each_active_root(root) { | |
2670 | 2668 | struct cgroup_subsys *ss; |
2671 | 2669 | struct cgroup *cgrp; |
2672 | 2670 | int subsys_id; |
2673 | 2671 | int count = 0; |
2674 | 2672 | |
2675 | - /* Skip this hierarchy if it has no active subsystems */ | |
2676 | - if (!root->actual_subsys_bits) | |
2677 | - continue; | |
2678 | 2673 | seq_printf(m, "%lu:", root->subsys_bits); |
2679 | 2674 | for_each_subsys(root, ss) |
2680 | 2675 | seq_printf(m, "%s%s", count++ ? "," : "", ss->name); |