From: Peter Zijlstra <peterz@infradead.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Eliezer Tamir <eliezer.tamir@linux.intel.com>,
John Stultz <john.stultz@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@elte.hu>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Tony Luck <tony.luck@gmail.com>, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [RFC][PATCH 5/7] x86: Use latch data structure for cyc2ns
Date: Sat, 30 Nov 2013 10:18:47 +0100 [thread overview]
Message-ID: <20131130091847.GF16796@laptop.programming.kicks-ass.net> (raw)
In-Reply-To: <CALCETrX=XvBP7-RjzCqMAV-3ZtMQY9XqBTOZOG3A85M9vhYwCw@mail.gmail.com>
On Fri, Nov 29, 2013 at 03:22:45PM -0800, Andy Lutomirski wrote:
> On Fri, Nov 29, 2013 at 9:37 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> > Use the 'latch' data structure for cyc2ns.
> >
> > This is a data structure first proposed by me and later named by
> > Mathieu. If anybody's got a better name; do holler.
>
> That structure must exist in the literature, but I have no idea what
> it's called. It's a multi-word lock-free atomic (I think -- maybe
> it's just regular) register. I even published a considerably fancier
> version of much the same thing a few years ago. :)
Yeah, its a fairly straight fwd thing it has to be named someplace ;-)
> I've occasionally wondered whether it would be possible to make a
> monotonicity-preserving version of this and use it for clock_gettime.
> One approach: have the writer set the time for the update to be a bit
> in the future and have the reader compare the current raw time to the
> cutoff to see which set of frequency/offset to use. (This requires
> having some kind of bound on how long it takes to update the data
> structures.)
>
> The advantage: clock_gettime would never block.
> The disadvantage: complicated, potentially nasty to implement, and it
> would get complicated if anyone tried to allow multiple updates in
> rapid succession.
Yes, that way you can chain a number of linear segments in various
slots, but you're indeed right in that it will limit the update
frequency. More slots will give you more room, but eventually you're
limited.
I suppose NTP is the primary updater in that case, does that have a
limit on the updates? All the other updates we can artificially limit,
that shouldn't really matter.
But yeah in my case we pretty much assume the TSC is complete crap and a
little more crap simply doesn't matter.
For the 'stable' tsc on modern machines we never set the frequency and
it doesn't matter anyway.
next prev parent reply other threads:[~2013-11-30 9:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-29 17:36 [RFC][PATCH 0/7] sched: Optimize sched_clock bits Peter Zijlstra
2013-11-29 17:36 ` [RFC][PATCH 1/7] math64: mul_u64_u32_shr() Peter Zijlstra
2013-11-29 17:36 ` [RFC][PATCH 2/7] x86: Use mul_u64_u32_shr() for native_sched_clock() Peter Zijlstra
2013-11-29 17:37 ` [RFC][PATCH 3/7] x86: Avoid a runtime condition in native_sched_clock() Peter Zijlstra
2013-11-29 17:37 ` [RFC][PATCH 4/7] x86: Move some code around Peter Zijlstra
2013-11-29 17:37 ` [RFC][PATCH 5/7] x86: Use latch data structure for cyc2ns Peter Zijlstra
2013-11-29 23:22 ` Andy Lutomirski
2013-11-30 9:18 ` Peter Zijlstra [this message]
2013-11-29 17:37 ` [RFC][PATCH 6/7] sched: Remove local_irq_disable() from the clocks Peter Zijlstra
2013-11-29 17:37 ` [RFC][PATCH 7/7] sched: Use a static_key for sched_clock_stable Peter Zijlstra
2013-12-01 18:08 ` [RFC][PATCH 0/7] sched: Optimize sched_clock bits Eliezer Tamir
2013-12-03 15:10 ` Peter Zijlstra
2013-12-10 14:47 ` Peter Zijlstra
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=20131130091847.GF16796@laptop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=eliezer.tamir@linux.intel.com \
--cc=hpa@zytor.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=tony.luck@gmail.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