From: Nicolas Pitre <nico@fluxnic.net>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Walleij <linus.walleij@stericsson.com>,
lkml <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Colin Cross <ccross@google.com>,
John Stultz <johnstul@us.ibm.com>, Ingo Molnar <mingo@redhat.com>,
Rabin Vincent <rabin.vincent@stericsson.com>
Subject: Re: [PATCH] clocksource: document some basic concepts
Date: Mon, 15 Nov 2010 15:06:29 -0500 (EST) [thread overview]
Message-ID: <alpine.LFD.2.00.1011151453370.6448@xanadu.home> (raw)
In-Reply-To: <1289818094.2109.487.camel@laptop>
On Mon, 15 Nov 2010, Peter Zijlstra wrote:
> On Mon, 2010-11-15 at 11:33 +0100, Linus Walleij wrote:
> > +The sched_clock() function may wrap only on unsigned long long boundaries,
> > +i.e. after 64 bits. Since this is a nanosecond value this will mean it wraps
> > +after circa 585 years. (For most practical systems this means "never".)
This is not necessarily the case. Some implementations require a
scaling factor too, making the number of remaining bits smaller than 64.
See arch/arm/mach-pxa/time.c:sched_clock() for example, which has a
maximum range of 208 days. Of course, in practice we don't really care
if sched_clock() wraps each 208 days, unlike for clock-source.
> Currently true, John Stultz was going to look into ammending this by
> teaching the kernel/sched_clock.c bits about early wraps (and a way for
> architectures to specify this)
>
> #define SCHED_CLOCK_WRAP_BITS 48
>
> ...
>
> #ifdef SCHED_CLOCK_WRAP_BITS
> /* handle short wraps */
> #endif
Is this worth supporting? I'd simply use the low 32 bits and extend it
to 63 bits using cnt32_to_63(). If the low 32 bits are wrapping too
fast, then just shifting them down a few positions first should do the
trick. That certainly would have a much faster result.
Nicolas
next prev parent reply other threads:[~2010-11-15 20:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-15 10:33 [PATCH] clocksource: document some basic concepts Linus Walleij
2010-11-15 10:48 ` Peter Zijlstra
2010-11-15 10:50 ` Peter Zijlstra
2010-11-15 19:48 ` john stultz
2010-11-15 20:06 ` Nicolas Pitre [this message]
2010-11-15 21:13 ` Peter Zijlstra
2010-11-15 16:34 ` Randy Dunlap
2010-11-15 19:45 ` 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=alpine.LFD.2.00.1011151453370.6448@xanadu.home \
--to=nico@fluxnic.net \
--cc=ccross@google.com \
--cc=johnstul@us.ibm.com \
--cc=linus.walleij@stericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rabin.vincent@stericsson.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;
as well as URLs for NNTP newsgroup(s).