From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ingo Molnar <mingo@elte.hu>
Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] posix-cpu-timers: clock_gettime(CLOCK_*_CPUTIME_ID) goes backward
Date: Fri, 26 Dec 2008 10:02:51 +0100 [thread overview]
Message-ID: <1230282171.9487.278.camel@twins> (raw)
In-Reply-To: <20081226084320.GC755@elte.hu>
On Fri, 2008-12-26 at 09:43 +0100, Ingo Molnar wrote:
> * Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> wrote:
>
> > @@ -321,7 +287,7 @@ static int cpu_clock_sample_group(const clockid_t which_clock,
> > cpu->cpu = cputime.utime;
> > break;
> > case CPUCLOCK_SCHED:
> > - cpu->sched = cputime.sum_exec_runtime + task_delta_exec(p);
> > + cpu->sched = cputime.sum_exec_runtime;
> > break;
> > }
>
> hm, doesnt this regress precision?
No, he folds it into:
> +void thread_group_cputime(struct task_struct *p, struct task_cputime *times)
> +{
> + unsigned long flags;
> + struct rq *rq;
> + u64 delta_exec = 0;
> + struct task_cputime *tot;
> + struct signal_struct *sig;
> + int i;
> +
> + sig = p->signal;
> + if (unlikely(!sig) || !sig->cputime.totals) {
> + times->utime = p->utime;
> + times->stime = p->stime;
> + times->sum_exec_runtime = task_total_exec(p);
> + return;
> + }
> +
> + times->stime = times->utime = cputime_zero;
> + times->sum_exec_runtime = 0;
> +
> + rq = task_rq_lock(p, &flags);
> +
> + if (task_current(rq, p)) {
> + update_rq_clock(rq);
> + delta_exec = rq->clock - p->se.exec_start;
> + if ((s64)delta_exec < 0)
> + delta_exec = 0;
> + }
> +
> + for_each_possible_cpu(i) {
> + tot = per_cpu_ptr(p->signal->cputime.totals, i);
> + times->utime = cputime_add(times->utime, tot->utime);
> + times->stime = cputime_add(times->stime, tot->stime);
> + times->sum_exec_runtime += tot->sum_exec_runtime;
> + }
> + times->sum_exec_runtime += delta_exec;
> +
> + task_rq_unlock(rq, &flags);
> +}
Which reminds me, why do we still have this crap in the kernel? I
thought we pretty much showed the per-cpu itimer thing was utter crap?
-- can we pretty please either revert that or apply
http://lkml.org/lkml/2008/11/24/183 ?
Also, I really don't like the above, we now do the per-cpu loop with the
RQ lock held...
next prev parent reply other threads:[~2008-12-26 9:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-26 6:01 [PATCH] posix-cpu-timers: clock_gettime(CLOCK_*_CPUTIME_ID) goes backward Hidetoshi Seto
2008-12-26 8:43 ` Ingo Molnar
2008-12-26 9:02 ` Peter Zijlstra [this message]
2008-12-26 9:07 ` Ingo Molnar
2009-01-05 6:59 ` Hidetoshi Seto
2009-01-21 5:54 ` [PATCH] posixtimers: " Hidetoshi Seto
2009-01-21 13:18 ` Peter Zijlstra
2009-01-07 17:59 ` [PATCH] posix-cpu-timers: " Ingo Molnar
2009-01-08 8:01 ` Peter Zijlstra
2009-01-27 5:51 ` [RESEND][PATCH] posixtimers: " Hidetoshi Seto
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=1230282171.9487.278.camel@twins \
--to=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=seto.hidetoshi@jp.fujitsu.com \
--cc=tglx@linutronix.de \
/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