[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1317807988.6766.10.camel@twins>
Date: Wed, 05 Oct 2011 11:46:28 +0200
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Glauber Costa <glommer@...allels.com>
Cc: linux-kernel@...r.kernel.org, paul@...lmenage.org,
lizf@...fujitsu.com, daniel.lezcano@...e.fr,
jbottomley@...allels.com, Balbir Singh <bsingharora@...il.com>,
Paul Turner <pjt@...gle.com>
Subject: Re: [PATCH 09/10] provide a version of cpuusage statistics inside
cpu cgroup
On Sun, 2011-10-02 at 23:21 +0400, Glauber Costa wrote:
> +/*
> + * charge this task's execution time to its accounting group.
> + *
> + * called with rq->lock held.
> + */
> +static void cpuusage_charge(struct task_struct *tsk, u64 cputime)
> +{
> + int cpu;
> +
> +#ifdef CONFIG_CGROUP_CPUACCT
> + struct cpuacct *ca;
> +#endif
> +#ifdef CONFIG_CGROUP_SCHED
> + struct task_group *tg;
> +#endif
> + cpu = task_cpu(tsk);
> +
> + rcu_read_lock();
> +
> +#ifdef CONFIG_CGROUP_CPUACCT
> + ca = task_ca(tsk);
> +
> + if (unlikely(!cpuacct_subsys.active))
> + goto no_cpuacct;
> +
> + for (; ca; ca = ca->parent) {
> + u64 *cpuusage = per_cpu_ptr(ca->cpuusage, cpu);
> + *cpuusage += cputime;
> + }
> +no_cpuacct:
> +#endif
> +
> +#ifdef CONFIG_CGROUP_SCHED
> + tg = task_group(tsk);
> + for (; tg; tg = tg->parent) {
> + u64 *cpuusage = per_cpu_ptr(tg->cpuusage, cpu);
> + *cpuusage += cputime;
> + }
> +#endif
> + rcu_read_unlock();
> +}
I don't actually think we need to do this. tg->se[cpu]->sum_exec_runtime
should contain the same information.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists