aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/cgroup.h
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2008-04-29 04:00:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:06:09 -0400
commit472b1053f3c319cc60bfb2a0bb062fed77a93eb6 (patch)
tree2ef88bfdb7e397d3718a1bed38f13194f894097e /include/linux/cgroup.h
parent08ce5f16ee466ffc5bf243800deeecd77d9eaf50 (diff)
cgroups: use a hash table for css_set finding
When we attach a process to a different cgroup, the css_set linked-list will be run through to find a suitable existing css_set to use. This patch implements a hash table for better performance. The following benchmarks have been tested: For N in 1, 5, 10, 50, 100, 500, 1000, create N cgroups with one sleeping task in each, and then move an additional task through each cgroup in turn. Here is a test result: N Loop orig - Time(s) hash - Time(s) ---------------------------------------------- 1 10000 1.201231728 1.196311177 5 2000 1.065743872 1.040566424 10 1000 0.991054735 0.986876440 50 200 0.976554203 0.969608733 100 100 0.998504680 0.969218270 500 20 1.157347764 0.962602963 1000 10 1.619521852 1.085140172 Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Reviewed-by: Paul Menage <menage@google.com> Cc: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: Pavel Emelyanov <xemul@openvz.org> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r--include/linux/cgroup.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 2d1d151258cf..f585b7cde87b 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -156,6 +156,12 @@ struct css_set {
156 struct list_head list; 156 struct list_head list;
157 157
158 /* 158 /*
159 * List running through all cgroup groups in the same hash
160 * slot. Protected by css_set_lock
161 */
162 struct hlist_node hlist;
163
164 /*
159 * List running through all tasks using this cgroup 165 * List running through all tasks using this cgroup
160 * group. Protected by css_set_lock 166 * group. Protected by css_set_lock
161 */ 167 */
@@ -174,7 +180,6 @@ struct css_set {
174 * during subsystem registration (at boot time). 180 * during subsystem registration (at boot time).
175 */ 181 */
176 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 182 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
177
178}; 183};
179 184
180/* 185/*