[RFC 5/5] sched: add cpusets to comounts list

Glauber Costa
2012-09-04T14:22:05Z

Although we have not yet identified any place where cpusets could be
improved performance-wise by guaranteeing comounts with the other two
cpu cgroups, it is a sane choice to mount them together.

We can preemptively benefit from it and avoid a growing mess, by
guaranteeing that subsystems that mostly contraint the same kind of
resource will live together. With cgroups is never that simple, and
things crosses boundaries quite often. But I hope this can be seen as a
potential improvement.

Signed-off-by: Glauber Costa <glommer@parallels.com>
CC: Dave Jones <davej@redhat.com>
CC: Ben Hutchings <ben@decadent.org.uk>
CC: Peter Zijlstra <a.p.zijlstra@chello.nl>
CC: Paul Turner <pjt@google.com>
CC: Lennart Poettering <lennart@poettering.net>
CC: Kay Sievers <kay.sievers@vrfy.org>
CC: Tejun Heo <tj@kernel.org>
---
kernel/cpuset.c | 4 ++++
kernel/sched/core.c | 8 ++++----
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 8c8bd65..f8e1c49 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1879,6 +1879,10 @@ struct cgroup_subsys cpuset_subsys = {
.post_clone = cpuset_post_clone,
.subsys_id = cpuset_subsys_id,
.base_cftypes = files,
+#ifdef CONFIG_CGROUP_FORCE_COMOUNT_CPU
+ .comounts = 2,
+ .must_comount = { cpu_cgroup_subsys_id, cpuacct_subsys_id, },
+#endif
.early_init = 1,
};

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d654bd1..aeff02c 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8301,8 +8301,8 @@ struct cgroup_subsys cpu_cgroup_subsys = {
.subsys_id = cpu_cgroup_subsys_id,
.base_cftypes = cpu_files,
#ifdef CONFIG_CGROUP_FORCE_COMOUNT_CPU
- .comounts = 1,
- .must_comount = { cpuacct_subsys_id, },
+ .comounts = 2,
+ .must_comount = { cpuacct_subsys_id, cpuset_subsys_id, },
.bind = cpu_cgroup_bind,
#endif
.early_init = 1,
@@ -8637,8 +8637,8 @@ struct cgroup_subsys cpuacct_subsys = {
.base_cftypes = files,
.bind = cpuacct_bind,
#ifdef CONFIG_CGROUP_FORCE_COMOUNT_CPU
- .comounts = 1,
- .must_comount = { cpu_cgroup_subsys_id, },
+ .comounts = 2,
+ .must_comount = { cpu_cgroup_subsys_id, cpuset_subsys_id, },
#endif
};
#endif /* CONFIG_CGROUP_CPUACCT */
--
1.7.11.4