From: Stanislaw Gruszka <sgruszka@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Oleg Nesterov <oleg@redhat.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH resend4 2/3] itimers: fix periodic tics precision
Date: Fri, 22 May 2009 16:34:38 +0200 [thread overview]
Message-ID: <20090522163438.71f895d1@dhcp-lab-109.englab.brq.redhat.com> (raw)
In-Reply-To: <alpine.LFD.2.00.0905221611380.3570@localhost.localdomain>
On Fri, 22 May 2009 16:27:40 +0200 (CEST)
Thomas Gleixner <tglx@linutronix.de> wrote:
> On Fri, 22 May 2009, Stanislaw Gruszka wrote:
> >
> > +#define CPUTIME_SUB_NS(ct, real_ns) ({ \
> > + struct timespec ts; \
> > + s64 cpu_ns; \
> > + cputime_to_timespec(ct, &ts); \
> > + cpu_ns = timespec_to_ns(&ts); \
> > + cpu_ns - real_ns; \
> > +})
> > +
>
> Please make this an inline function. Also this should have a sanity
> check for values < 0, which might happen due to rounding errors. In
> that case you set it simply to 0.
Ok.
> > if (cputime_ge(cur_time, it->expires)) {
> > - it->expires = it->incr;
> > - if (!cputime_eq(it->expires, cputime_zero))
> > - it->expires = cputime_add(it->expires, cur_time);
> > + if (!cputime_eq(it->incr, cputime_zero)) {
> > + it->expires = cputime_add(it->expires, it->incr);
> > + it->error += it->incr_error;
> > + if (it->error >= onecputick) {
> > + it->expires = cputime_sub(it->expires,
> > + jiffies_to_cputime(1));
> > + it->error -= onecputick;
> > + }
>
> Yep, that's a sane solution except for jiffies_to_cputime(), which
> can be precomputed as well.
Ok, I forgot PPC exist.
Thanks
Stanislaw
next prev parent reply other threads:[~2009-05-22 14:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-22 13:43 Stanislaw Gruszka
2009-05-22 14:27 ` Thomas Gleixner
2009-05-22 14:34 ` Stanislaw Gruszka [this message]
2009-05-25 11:28 ` Stanislaw Gruszka
2009-05-25 12:32 ` Thomas Gleixner
2009-05-25 12:51 ` Stanislaw Gruszka
2009-05-26 6:44 ` Stanislaw Gruszka
2009-05-26 12:04 ` Thomas Gleixner
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=20090522163438.71f895d1@dhcp-lab-109.englab.brq.redhat.com \
--to=sgruszka@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@redhat.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
all inboxes | Powered by JetHome®