diff options
author | Paul Menage <menage@google.com> | 2007-10-19 02:39:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-19 14:53:36 -0400 |
commit | 817929ec274bcfe771586d338bb31d1659615686 (patch) | |
tree | 5a96ed1afd308016e8720437a00bf2f114e907cb /include/linux/sched.h | |
parent | a424316ca154317367c7ddf89997d1c80e4a8051 (diff) |
Task Control Groups: shared cgroup subsystem group arrays
Replace the struct css_set embedded in task_struct with a pointer; all tasks
that have the same set of memberships across all hierarchies will share a
css_set object, and will be linked via their css_sets field to the "tasks"
list_head in the css_set.
Assuming that many tasks share the same cgroup assignments, this reduces
overall space usage and keeps the size of the task_struct down (three pointers
added to task_struct compared to a non-cgroups kernel, no matter how many
subsystems are registered).
[akpm@linux-foundation.org: fix a printk]
[akpm@linux-foundation.org: build fix]
Signed-off-by: Paul Menage <menage@google.com>
Cc: Serge E. Hallyn <serue@us.ibm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Paul Jackson <pj@sgi.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Srivatsa Vaddagiri <vatsa@in.ibm.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
Cc: Serge E. Hallyn <serue@us.ibm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Paul Jackson <pj@sgi.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Srivatsa Vaddagiri <vatsa@in.ibm.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
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/sched.h')
-rw-r--r-- | include/linux/sched.h | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index af2ed4bae678..1aa1cfa63b37 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -894,34 +894,6 @@ struct sched_entity { | |||
894 | #endif | 894 | #endif |
895 | }; | 895 | }; |
896 | 896 | ||
897 | #ifdef CONFIG_CGROUPS | ||
898 | |||
899 | #define SUBSYS(_x) _x ## _subsys_id, | ||
900 | enum cgroup_subsys_id { | ||
901 | #include <linux/cgroup_subsys.h> | ||
902 | CGROUP_SUBSYS_COUNT | ||
903 | }; | ||
904 | #undef SUBSYS | ||
905 | |||
906 | /* A css_set is a structure holding pointers to a set of | ||
907 | * cgroup_subsys_state objects. | ||
908 | */ | ||
909 | |||
910 | struct css_set { | ||
911 | |||
912 | /* Set of subsystem states, one for each subsystem. NULL for | ||
913 | * subsystems that aren't part of this hierarchy. These | ||
914 | * pointers reduce the number of dereferences required to get | ||
915 | * from a task to its state for a given cgroup, but result | ||
916 | * in increased space usage if tasks are in wildly different | ||
917 | * groupings across different hierarchies. This array is | ||
918 | * immutable after creation */ | ||
919 | struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; | ||
920 | |||
921 | }; | ||
922 | |||
923 | #endif /* CONFIG_CGROUPS */ | ||
924 | |||
925 | struct task_struct { | 897 | struct task_struct { |
926 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ | 898 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ |
927 | void *stack; | 899 | void *stack; |
@@ -1159,7 +1131,10 @@ struct task_struct { | |||
1159 | int cpuset_mem_spread_rotor; | 1131 | int cpuset_mem_spread_rotor; |
1160 | #endif | 1132 | #endif |
1161 | #ifdef CONFIG_CGROUPS | 1133 | #ifdef CONFIG_CGROUPS |
1162 | struct css_set cgroups; | 1134 | /* Control Group info protected by css_set_lock */ |
1135 | struct css_set *cgroups; | ||
1136 | /* cg_list protected by css_set_lock and tsk->alloc_lock */ | ||
1137 | struct list_head cg_list; | ||
1163 | #endif | 1138 | #endif |
1164 | #ifdef CONFIG_FUTEX | 1139 | #ifdef CONFIG_FUTEX |
1165 | struct robust_list_head __user *robust_list; | 1140 | struct robust_list_head __user *robust_list; |