OpenVZ Forum - RDF feed
type: channel
items: [RFC] special case cpuacct cpuusage when cpu cgroup is comounted

[RFC] special case cpuacct cpuusage when cpu cgroup is comounted
type: item
description: The cpuacct cgroup needs to do hierarchy walks in scheduler core paths to update its cpuusage information. For the cfs case it is even worse, since we already track this data in cfs_rq's exec_clock. We can't really get rid of it in a clean way, but we can do a lot better when cpu an cpuacct are mounted in the same hierarchy: in this case, we're guaranteed to have the same set of tasks. There is then no need to walk the cpuacct hierachy, since what we record for the task_group will yield the same results. For the rt tasks, we need to record tg's rt_rq total execution time somewhere in the struct, since it was not provided before. Please let me know what you guys think of this. Signed-off-by: Glauber Costa <glommer@parallels.com> CC: Paul Turner <pjt@google.com> CC: Li Zefan <lizf@cn.fujitsu.com> CC: Peter Zijlstra <a.p.zijlstra@chello.nl> --- kernel/sched/core.c | 198 ++++++++++++++++++++++++++++++++++++++++++++++--- kernel/sched/rt.c | 6 ++ kernel/sched/sched.h | 4 + 3 files changed, 195 insertions(+), 13 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a28034d..d44ce99 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6810,6 +6810,45 @@ int in_sched_functions(unsigned long addr) struct task_group root_task_group; #endif +#if defined(CONFIG_CGROUP_SCHED) && defined(CONFIG_CGROUP_CPUACCT) +struct jump_label_key cpu_cpuacct_comounted_branch; + +static void cpu_cpuacct_update_jump_labels(struct cgroup *root, + struct cgroupfs_root *sys_root) +{ + /* When we are adding a cgroup, we first bind it to the new root, + * then call bind(). + * When deleting one, we first call bind(), then move it away. + * + * As a result, when the two roots are different, we can be sure that + * we're either adding the first one of them in a hierarchy, or we + * are deleting the last of them. In any of those cases, we don't need + * to mess with the jump labels. (first test) + * + * So if our root equals the root bind() were provided, that's because + * …
creator: Glauber Costa
date: 2011-12-22T09:06:22-00:00