public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: John Stultz <john.stultz@linaro.org>, Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Eric Dumazet <dada1@cosmosbay.com>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: [RFC patch 5/8] timekeeping: Store cycle_last value in timekeeper struct as well
Date: Thu, 21 Feb 2013 22:51:38 -0000	[thread overview]
Message-ID: <20130221224231.033750368@linutronix.de> (raw)
In-Reply-To: 20130221220147.719832397@linutronix.de

[-- Attachment #1: timekeeping-store-cycle-last-in-timekeeper.patch --]
[-- Type: text/plain, Size: 1864 bytes --]

For implementing a shadow timekeeper and a split calculation/update
region we need to store the cycle_last value in the timekeeper and
update the value in the clocksource struct only in the update region.

Add the extra storage to the timekeeper.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/timekeeper_internal.h |    2 ++
 kernel/time/timekeeping.c           |    4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

Index: linux-2.6/include/linux/timekeeper_internal.h
===================================================================
--- linux-2.6.orig/include/linux/timekeeper_internal.h
+++ linux-2.6/include/linux/timekeeper_internal.h
@@ -20,6 +20,8 @@ struct timekeeper {
 	u32			shift;
 	/* Number of clock cycles in one NTP interval. */
 	cycle_t			cycle_interval;
+	/* Last cycle value (also stored in clock->cycle_last) */
+	cycle_t			cycle_last;
 	/* Number of clock shifted nano seconds in one NTP interval. */
 	u64			xtime_interval;
 	/* shifted nano seconds left over when rounding cycle_interval */
Index: linux-2.6/kernel/time/timekeeping.c
===================================================================
--- linux-2.6.orig/kernel/time/timekeeping.c
+++ linux-2.6/kernel/time/timekeeping.c
@@ -99,7 +99,7 @@ static void tk_setup_internals(struct ti
 
 	old_clock = tk->clock;
 	tk->clock = clock;
-	clock->cycle_last = clock->read(clock);
+	tk->cycle_last = clock->cycle_last = clock->read(clock);
 
 	/* Do the ns -> cycle conversion first, using original mult */
 	tmp = NTP_INTERVAL_LENGTH;
@@ -250,7 +250,7 @@ static void timekeeping_forward_now(stru
 	clock = tk->clock;
 	cycle_now = clock->read(clock);
 	cycle_delta = (cycle_now - clock->cycle_last) & clock->mask;
-	clock->cycle_last = cycle_now;
+	tk->cycle_last = clock->cycle_last = cycle_now;
 
 	tk->xtime_nsec += cycle_delta * tk->mult;
 



  parent reply	other threads:[~2013-02-21 22:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-21 22:51 [RFC patch 0/8] timekeeping: Implement shadow timekeeper to shorten in kernel reader side blocking Thomas Gleixner
2013-02-21 22:51 ` [RFC patch 1/8] timekeeping: Calc stuff once Thomas Gleixner
2013-02-21 22:51 ` [RFC patch 2/8] timekeeping: Make jiffies_lock internal Thomas Gleixner
2013-02-21 22:51 ` [RFC patch 3/8] timekeeping: Move lock out of timekeeper struct Thomas Gleixner
2013-02-21 22:51 ` Thomas Gleixner [this message]
2013-02-21 22:51 ` [RFC patch 4/8] timekeeping: Split timekeeper_lock into lock and seqcount Thomas Gleixner
2013-02-21 22:51 ` [RFC patch 6/8] timekeeping: Delay update of clock->cycle_last Thomas Gleixner
2013-02-21 22:51 ` [RFC patch 8/8] timekeeping: Shorten seq_count region Thomas Gleixner
2013-02-21 22:51 ` [RFC patch 7/8] timekeeping: Implement a shadow timekeeper Thomas Gleixner
2013-02-22 23:53   ` John Stultz
2013-02-26 12:17     ` Thomas Gleixner
2013-02-21 23:06 ` [RFC patch 0/8] timekeeping: Implement shadow timekeeper to shorten in kernel reader side blocking Eric Dumazet

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=20130221224231.033750368@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=dada1@cosmosbay.com \
    --cc=fweisbec@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /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