From: Richard Cochran <richardcochran@gmail.com>
To: Christoph Lameter <cl@linux.com>
Cc: John Stultz <john.stultz@linaro.org>,
lkml <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
Eric Dumazet <eric.dumazet@gmail.com>
Subject: Re: [PATCH 1/9] time: Condense timekeeper.xtime into xtime_sec
Date: Sat, 3 Mar 2012 06:54:12 +0100 [thread overview]
Message-ID: <20120303055411.GA3835@netboy.at.omicron.at> (raw)
In-Reply-To: <alpine.DEB.2.00.1203021510540.20257@router.home>
On Fri, Mar 02, 2012 at 03:13:25PM -0600, Christoph Lameter wrote:
> On Thu, 1 Mar 2012, John Stultz wrote:
>
> > +static inline void tk_normalize_xtime(struct timekeeper *tk)
> > +{
> > + while (tk->xtime_nsec >= ((u64)NSEC_PER_SEC << tk->shift)) {
> > + tk->xtime_nsec -= (u64)NSEC_PER_SEC << tk->shift;
> > + tk->xtime_sec++;
> > + }
> > +}
>
> Could we avoid the loop?
>
> y = ((u64)NSEC_PER_SEC << tk->shift));
> tk->xtime_sec += tk->xtime_nsec / y;
> tk->xtime_nsec %= y;
But the two divisions are more costly than addition, substraction, and
shift.
(Normally the code loops just once.)
Richard
next prev parent reply other threads:[~2012-03-03 5:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-02 7:12 [PATCH 0/9] Reduce timekeeping lock hold time v2 John Stultz
2012-03-02 7:12 ` [PATCH 1/9] time: Condense timekeeper.xtime into xtime_sec John Stultz
2012-03-02 21:13 ` Christoph Lameter
2012-03-03 5:54 ` Richard Cochran [this message]
2012-03-02 7:12 ` [PATCH 2/9] time: Rework timekeeping functions to take timekeeper ptr as argument John Stultz
2012-03-02 7:12 ` [PATCH 3/9] time: Split timekeeper lock into separate reader/writer locks John Stultz
2012-03-02 7:12 ` [PATCH 4/9] time: Update timekeeper structure using a local shadow John Stultz
2012-03-02 7:38 ` Ingo Molnar
2012-03-02 7:53 ` John Stultz
2012-03-02 8:07 ` Ingo Molnar
2012-03-02 7:12 ` [PATCH 5/9] time: Shadow cycle_last in timekeeper structure John Stultz
2012-03-02 7:12 ` [PATCH 6/9] time: Reduce timekeeper read lock hold time John Stultz
2012-03-02 7:12 ` [PATCH 7/9] time: Convert the timekeeper's wlock to a raw_spin_lock John Stultz
2012-03-02 7:12 ` [PATCH 8/9] time: Whitespace cleanups per Ingo's requests John Stultz
2012-03-02 7:12 ` [PATCH 9/9] time: Explicitly use u32 instead of int for shift values John Stultz
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=20120303055411.GA3835@netboy.at.omicron.at \
--to=richardcochran@gmail.com \
--cc=cl@linux.com \
--cc=eric.dumazet@gmail.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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®