From: tip-bot for Peter Zijlstra <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, mingo@kernel.org, hpa@zytor.com,
tglx@linutronix.de, linux-kernel@vger.kernel.org,
john.stultz@linaro.org
Subject: [tip:perf/timer] time: Parametrize all tk_fast_mono users
Date: Fri, 27 Mar 2015 04:45:15 -0700 [thread overview]
Message-ID: <tip-4498e7467e9e441c18ca12f1ca08460356e0508a@git.kernel.org> (raw)
In-Reply-To: <20150319093400.484279927@infradead.org>
Commit-ID: 4498e7467e9e441c18ca12f1ca08460356e0508a
Gitweb: http://git.kernel.org/tip/4498e7467e9e441c18ca12f1ca08460356e0508a
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Thu, 19 Mar 2015 09:36:19 +0100
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 27 Mar 2015 09:45:08 +0100
time: Parametrize all tk_fast_mono users
In preparation for more tk_fast instances, remove all hard-coded
tk_fast_mono references.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20150319093400.484279927@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/time/timekeeping.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index cbb612e..278373e 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -364,18 +364,18 @@ static inline s64 timekeeping_get_ns(struct tk_read_base *tkr)
* slightly wrong timestamp (a few nanoseconds). See
* @ktime_get_mono_fast_ns.
*/
-static void update_fast_timekeeper(struct tk_read_base *tkr)
+static void update_fast_timekeeper(struct tk_read_base *tkr, struct tk_fast *tkf)
{
- struct tk_read_base *base = tk_fast_mono.base;
+ struct tk_read_base *base = tkf->base;
/* Force readers off to base[1] */
- raw_write_seqcount_latch(&tk_fast_mono.seq);
+ raw_write_seqcount_latch(&tkf->seq);
/* Update base[0] */
memcpy(base, tkr, sizeof(*base));
/* Force readers back to base[0] */
- raw_write_seqcount_latch(&tk_fast_mono.seq);
+ raw_write_seqcount_latch(&tkf->seq);
/* Update base[1] */
memcpy(base + 1, base, sizeof(*base));
@@ -413,20 +413,25 @@ static void update_fast_timekeeper(struct tk_read_base *tkr)
* of the following timestamps. Callers need to be aware of that and
* deal with it.
*/
-u64 notrace ktime_get_mono_fast_ns(void)
+static __always_inline u64 __ktime_get_fast_ns(struct tk_fast *tkf)
{
struct tk_read_base *tkr;
unsigned int seq;
u64 now;
do {
- seq = raw_read_seqcount(&tk_fast_mono.seq);
- tkr = tk_fast_mono.base + (seq & 0x01);
+ seq = raw_read_seqcount(&tkf->seq);
+ tkr = tkf->base + (seq & 0x01);
now = ktime_to_ns(tkr->base) + timekeeping_get_ns(tkr);
+ } while (read_seqcount_retry(&tkf->seq, seq));
- } while (read_seqcount_retry(&tk_fast_mono.seq, seq));
return now;
}
+
+u64 ktime_get_mono_fast_ns(void)
+{
+ return __ktime_get_fast_ns(&tk_fast_mono);
+}
EXPORT_SYMBOL_GPL(ktime_get_mono_fast_ns);
/* Suspend-time cycles value for halted fast timekeeper. */
@@ -455,7 +460,7 @@ static void halt_fast_timekeeper(struct timekeeper *tk)
memcpy(&tkr_dummy, tkr, sizeof(tkr_dummy));
cycles_at_suspend = tkr->read(tkr->clock);
tkr_dummy.read = dummy_clock_read;
- update_fast_timekeeper(&tkr_dummy);
+ update_fast_timekeeper(&tkr_dummy, &tk_fast_mono);
}
#ifdef CONFIG_GENERIC_TIME_VSYSCALL_OLD
@@ -586,7 +591,7 @@ static void timekeeping_update(struct timekeeper *tk, unsigned int action)
memcpy(&shadow_timekeeper, &tk_core.timekeeper,
sizeof(tk_core.timekeeper));
- update_fast_timekeeper(&tk->tkr_mono);
+ update_fast_timekeeper(&tk->tkr_mono, &tk_fast_mono);
}
/**
next prev parent reply other threads:[~2015-03-27 11:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-19 9:31 [RFC][PATCH 0/4] Another go at ktime_get_raw_fast_ns() Peter Zijlstra
2015-03-19 9:31 ` [RFC][PATCH 1/4] time: Rename timekeeper::tkr to timekeeper::tkr_mono Peter Zijlstra
2015-03-27 11:44 ` [tip:perf/timer] time: Rename timekeeper::tkr to timekeeper:: tkr_mono tip-bot for Peter Zijlstra
2015-03-19 9:31 ` [RFC][PATCH 2/4] time: Add timerkeeper::tkr_raw Peter Zijlstra
2015-03-27 11:44 ` [tip:perf/timer] " tip-bot for Peter Zijlstra
2015-03-19 9:31 ` [RFC][PATCH 3/4] time: Parametrize all tk_fast_mono users Peter Zijlstra
2015-03-27 11:45 ` tip-bot for Peter Zijlstra [this message]
2015-03-19 9:31 ` [RFC][PATCH 4/4] time: Introduce tk_fast_raw Peter Zijlstra
2015-03-27 11:45 ` [tip:perf/timer] " tip-bot for Peter Zijlstra
2015-03-24 15:20 ` [RFC][PATCH 0/4] Another go at ktime_get_raw_fast_ns() John Stultz
2015-03-24 15:48 ` Peter Zijlstra
2015-03-24 16:00 ` John Stultz
2015-03-24 21:02 ` John Stultz
2015-03-25 14:58 ` 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=tip-4498e7467e9e441c18ca12f1ca08460356e0508a@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--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
Powered by JetHome