mirror of https://lore.kernel.org/lkml/
 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>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Richard Cochran <richardcochran@gmail.com>
Subject: [patch 3/7] timekeeping: Make seqcount sections smaller
Date: Sun, 13 Nov 2011 23:19:48 -0000	[thread overview]
Message-ID: <20111113231341.602682242@linutronix.de> (raw)
In-Reply-To: <20111113230921.728083714@linutronix.de>

[-- Attachment #1: xtime-timekeeping-seqcount-sections.patch --]
[-- Type: text/plain, Size: 2706 bytes --]

Move the seqcount bump inside of do_timer() and remove it from
sections which only need the xtime_lock serialization.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/time/tick-common.c |    2 --
 kernel/time/tick-sched.c  |    4 ----
 kernel/time/timekeeping.c |    4 ++--
 3 files changed, 2 insertions(+), 8 deletions(-)

Index: linux-2.6/kernel/time/tick-common.c
===================================================================
--- linux-2.6.orig/kernel/time/tick-common.c
+++ linux-2.6/kernel/time/tick-common.c
@@ -64,13 +64,11 @@ static void tick_periodic(int cpu)
 {
 	if (tick_do_timer_cpu == cpu) {
 		raw_spin_lock(&xtime_lock);
-		write_seqcount_begin(&xtime_seq);
 
 		/* Keep track of the next tick event */
 		tick_next_period = ktime_add(tick_next_period, tick_period);
 
 		do_timer(1);
-		write_seqcount_end(&xtime_seq);
 		raw_spin_unlock(&xtime_lock);
 	}
 
Index: linux-2.6/kernel/time/tick-sched.c
===================================================================
--- linux-2.6.orig/kernel/time/tick-sched.c
+++ linux-2.6/kernel/time/tick-sched.c
@@ -57,7 +57,6 @@ static void tick_do_update_jiffies64(kti
 
 	/* Reevalute with xtime_lock held */
 	raw_spin_lock(&xtime_lock);
-	write_seqcount_begin(&xtime_seq);
 
 	delta = ktime_sub(now, last_jiffies_update);
 	if (delta.tv64 >= tick_period.tv64) {
@@ -80,7 +79,6 @@ static void tick_do_update_jiffies64(kti
 		/* Keep the tick_next_period variable up to date */
 		tick_next_period = ktime_add(last_jiffies_update, tick_period);
 	}
-	write_seqcount_end(&xtime_seq);
 	raw_spin_unlock(&xtime_lock);
 }
 
@@ -92,12 +90,10 @@ static ktime_t tick_init_jiffy_update(vo
 	ktime_t period;
 
 	raw_spin_lock(&xtime_lock);
-	write_seqcount_begin(&xtime_seq);
 	/* Did we start the jiffies update yet ? */
 	if (last_jiffies_update.tv64 == 0)
 		last_jiffies_update = tick_next_period;
 	period = last_jiffies_update;
-	write_seqcount_end(&xtime_seq);
 	raw_spin_unlock(&xtime_lock);
 	return period;
 }
Index: linux-2.6/kernel/time/timekeeping.c
===================================================================
--- linux-2.6.orig/kernel/time/timekeeping.c
+++ linux-2.6/kernel/time/timekeeping.c
@@ -1116,8 +1116,10 @@ struct timespec get_monotonic_coarse(voi
  */
 void do_timer(unsigned long ticks)
 {
+	write_seqcount_begin(&xtime_seq);
 	jiffies_64 += ticks;
 	update_wall_time();
+	write_seqcount_end(&xtime_seq);
 	calc_global_load(ticks);
 }
 
@@ -1165,8 +1167,6 @@ ktime_t ktime_get_monotonic_offset(void)
 void xtime_update(unsigned long ticks)
 {
 	raw_spin_lock(&xtime_lock);
-	write_seqcount_begin(&xtime_seq);
 	do_timer(ticks);
-	write_seqcount_end(&xtime_seq);
 	raw_spin_unlock(&xtime_lock);
 }



  parent reply	other threads:[~2011-11-13 23:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-13 23:19 [patch 0/7] timekeeping: Decouple xtime_lock from xtime seqcount Thomas Gleixner
2011-11-13 23:19 ` [patch 2/7] ntp: Shorten xtime seqcount sections Thomas Gleixner
2011-11-13 23:19 ` [patch 1/7] timekeeping: Split xtime lock into lock and seqcount Thomas Gleixner
2011-11-13 23:19 ` [patch 4/7] timekeeper: Reorder so the hot data is together Thomas Gleixner
2011-11-13 23:19 ` Thomas Gleixner [this message]
2011-11-13 23:19 ` [patch 6/7] timekeeping: Add extra timekeeper/xtime structs for calculation Thomas Gleixner
2011-11-13 23:19 ` [patch 5/7] timekeeping: Move common updates to a function Thomas Gleixner
2011-11-13 23:19 ` [patch 7/7] timekeeping: Reduce seqcount section to update timekeeper/xtime Thomas Gleixner
2011-11-14  6:28 ` [patch 0/7] timekeeping: Decouple xtime_lock from xtime seqcount 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=20111113231341.602682242@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=eric.dumazet@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richardcochran@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

all inboxes | Powered by JetHome®