From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Glauber Costa <glommer@parallels.com>
Cc: linux-kernel@vger.kernel.org, xemul@parallels.com,
paul@paulmenage.org, lizf@cn.fujitsu.com, daniel.lezcano@free.fr,
mingo@elte.hu, jbottomley@parallels.com
Subject: Re: [PATCH 8/9] per-cgroup boot time
Date: Tue, 20 Sep 2011 11:25:46 +0200 [thread overview]
Message-ID: <1316510746.11841.18.camel@twins> (raw)
In-Reply-To: <1316030695-19826-9-git-send-email-glommer@parallels.com>
On Wed, 2011-09-14 at 17:04 -0300, Glauber Costa wrote:
> Record the time in which the cgroup was created. This can be
> used to provide a more accurate boottime information in
> cpuacct.proc.stat.
>
> Signed-off-by: Glauber Costa <glommer@parallels.com>
> ---
> kernel/sched.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/sched.c b/kernel/sched.c
> index 4611c54..8f254d0 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -9120,6 +9120,7 @@ struct cpuacct {
> /* cpuusage holds pointer to a u64-type object on every cpu */
> u64 __percpu *cpuusage;
> u64 __percpu *cpustat;
> + struct timespec start_time;
> };
>
> struct cgroup_subsys cpuacct_subsys;
> @@ -9172,6 +9173,8 @@ static struct cgroup_subsys_state *cpuacct_create(
> acct[CPUACCT_STAT_IDLE] = kstat_cpu(i).cpustat.idle;
> acct[CPUACCT_STAT_IOWAIT] = kstat_cpu(i).cpustat.iowait;
> }
> +
> + get_monotonic_boottime(&ca->start_time);
> return &ca->css;
>
> out_free_usage:
> @@ -9316,13 +9319,16 @@ static int cpuacct_proc_stat(struct cgroup *cgrp, struct cftype *cft,
> unsigned int per_softirq_sums[NR_SOFTIRQS] = {0};
> struct timespec boottime;
> struct cpuacct *ca = cgroup_ca(cgrp);
> + struct timespec ts;
> u64 *cpustat;
>
> user = nice = system = idle = iowait =
> irq = softirq = steal = cputime64_zero;
> guest = guest_nice = cputime64_zero;
> getboottime(&boottime);
> - jif = boottime.tv_sec;
> + getboottime(&boottime);
> + ts = timespec_add(boottime, ca->start_time);
> + jif = ts.tv_sec;
>
> for_each_possible_cpu(i) {
> cpustat = per_cpu_ptr(ca->cpustat, i);
I'm confused, what does it do? You take a boot time timestamp at cgroup
creation, add that to all boot-time readings and print the result. How
does that make sense? Subtracting the start_time, maybe, that would make
the cgroup creation time 0, adding, not so much.
next prev parent reply other threads:[~2011-09-20 9:26 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-14 20:04 [PATCH 0/9] Per-cgroup /proc/stat Glauber Costa
2011-09-14 20:04 ` [PATCH 1/9] Remove parent field in cpuacct cgroup Glauber Costa
2011-09-19 16:03 ` Peter Zijlstra
2011-09-19 16:09 ` Glauber Costa
2011-09-19 16:19 ` Peter Zijlstra
2011-09-19 16:30 ` Glauber Costa
2011-09-19 16:39 ` Peter Zijlstra
2011-09-19 16:41 ` Glauber Costa
2011-09-19 18:40 ` Peter Zijlstra
2011-09-20 17:29 ` Srivatsa Vaddagiri
2011-09-22 15:11 ` Balbir Singh
2011-09-22 15:17 ` Peter Zijlstra
2011-09-23 8:09 ` Balbir Singh
2011-09-23 14:35 ` Peter Zijlstra
2011-09-23 15:45 ` Glauber Costa
2011-09-19 18:35 ` Peter Zijlstra
2011-09-19 18:38 ` Glauber Costa
2011-09-19 18:44 ` Peter Zijlstra
2011-09-19 19:14 ` Glauber Costa
2011-09-19 19:18 ` Peter Zijlstra
2011-09-19 19:19 ` Glauber Costa
2011-09-14 20:04 ` [PATCH 2/9] Make cpuacct fields per cpu variables Glauber Costa
2011-09-19 16:10 ` Peter Zijlstra
2011-09-14 20:04 ` [PATCH 3/9] Include nice values in cpuacct Glauber Costa
2011-09-19 16:19 ` Peter Zijlstra
2011-09-19 16:26 ` Glauber Costa
2011-09-19 18:36 ` Peter Zijlstra
2011-09-19 18:37 ` Glauber Costa
2011-09-14 20:04 ` [PATCH 4/9] Include irq and softirq fields " Glauber Costa
2011-09-19 18:38 ` Peter Zijlstra
2011-09-19 18:40 ` Glauber Costa
2011-09-14 20:04 ` [PATCH 5/9] Include guest " Glauber Costa
2011-09-14 20:04 ` [PATCH 6/9] Include idle and iowait " Glauber Costa
2011-09-20 9:21 ` Peter Zijlstra
2011-09-20 12:36 ` Glauber Costa
2011-09-20 12:58 ` Peter Zijlstra
2011-09-20 12:58 ` Glauber Costa
2011-09-20 13:05 ` Peter Zijlstra
2011-09-20 13:29 ` Glauber Costa
2011-09-14 20:04 ` [PATCH 7/9] Create cpuacct.proc.stat file Glauber Costa
2011-09-20 9:22 ` Peter Zijlstra
2011-09-20 12:22 ` Glauber Costa
2011-09-14 20:04 ` [PATCH 8/9] per-cgroup boot time Glauber Costa
2011-09-20 9:25 ` Peter Zijlstra [this message]
2011-09-20 12:37 ` Glauber Costa
2011-09-20 13:04 ` Peter Zijlstra
2011-09-20 13:06 ` Glauber Costa
2011-09-20 13:31 ` Peter Zijlstra
2011-09-14 20:04 ` [PATCH 9/9] Report steal time for cgroup Glauber Costa
2011-09-20 9:29 ` Peter Zijlstra
2011-09-14 20:13 ` [PATCH 0/9] Per-cgroup /proc/stat Peter Zijlstra
2011-09-14 20:20 ` Glauber Costa
2011-09-15 8:53 ` Peter Zijlstra
2011-09-14 20:23 ` Andi Kleen
2011-09-15 8:56 ` Peter Zijlstra
2011-09-19 23:07 ` Paul Turner
2011-09-20 8:33 ` Peter Zijlstra
2011-09-20 21:37 ` Glauber Costa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1316510746.11841.18.camel@twins \
--to=a.p.zijlstra@chello.nl \
--cc=daniel.lezcano@free.fr \
--cc=glommer@parallels.com \
--cc=jbottomley@parallels.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@elte.hu \
--cc=paul@paulmenage.org \
--cc=xemul@parallels.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox