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 2/7] ntp: Shorten xtime seqcount sections
Date: Sun, 13 Nov 2011 23:19:47 -0000	[thread overview]
Message-ID: <20111113231341.531749654@linutronix.de> (raw)
In-Reply-To: <20111113230921.728083714@linutronix.de>

[-- Attachment #1: xtime-ntp-shorten-seqcount-sections.patch --]
[-- Type: text/plain, Size: 2938 bytes --]

We only need to bump the seqcount for the actual leap seconds
injection.

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

Index: linux-2.6/kernel/time/ntp.c
===================================================================
--- linux-2.6.orig/kernel/time/ntp.c
+++ linux-2.6/kernel/time/ntp.c
@@ -359,7 +359,6 @@ static enum hrtimer_restart ntp_leap_sec
 	enum hrtimer_restart res = HRTIMER_NORESTART;
 
 	raw_spin_lock(&xtime_lock);
-	write_seqcount_begin(&xtime_seq);
 
 	switch (time_state) {
 	case TIME_OK:
@@ -389,7 +388,6 @@ static enum hrtimer_restart ntp_leap_sec
 		break;
 	}
 
-	write_seqcount_end(&xtime_seq);
 	raw_spin_unlock(&xtime_lock);
 
 	return res;
@@ -666,7 +664,6 @@ int do_adjtimex(struct timex *txc)
 	getnstimeofday(&ts);
 
 	raw_spin_lock_irq(&xtime_lock);
-	write_seqcount_begin(&xtime_seq);
 
 	if (txc->modes & ADJ_ADJTIME) {
 		long save_adjust = time_adjust;
@@ -708,7 +705,6 @@ int do_adjtimex(struct timex *txc)
 	/* fill PPS status fields */
 	pps_fill_timex(txc);
 
-	write_seqcount_end(&xtime_seq);
 	raw_spin_unlock_irq(&xtime_lock);
 
 	txc->time.tv_sec = ts.tv_sec;
@@ -908,7 +904,6 @@ void hardpps(const struct timespec *phas
 	pts_norm = pps_normalize_ts(*phase_ts);
 
 	raw_spin_lock_irqsave(&xtime_lock, flags);
-	write_seqcount_begin(&xtime_seq);
 
 	/* clear the error bits, they will be set again if needed */
 	time_status &= ~(STA_PPSJITTER | STA_PPSWANDER | STA_PPSERROR);
@@ -921,7 +916,6 @@ void hardpps(const struct timespec *phas
 	 * just start the frequency interval */
 	if (unlikely(pps_fbase.tv_sec == 0)) {
 		pps_fbase = *raw_ts;
-		write_seqcount_end(&xtime_seq);
 		raw_spin_unlock_irqrestore(&xtime_lock, flags);
 		return;
 	}
@@ -937,7 +931,6 @@ void hardpps(const struct timespec *phas
 		time_status |= STA_PPSJITTER;
 		/* restart the frequency calibration interval */
 		pps_fbase = *raw_ts;
-		write_seqcount_end(&xtime_seq);
 		raw_spin_unlock_irqrestore(&xtime_lock, flags);
 		pr_err("hardpps: PPSJITTER: bad pulse\n");
 		return;
@@ -955,7 +948,6 @@ void hardpps(const struct timespec *phas
 
 	hardpps_update_phase(pts_norm.nsec);
 
-	write_seqcount_end(&xtime_seq);
 	raw_spin_unlock_irqrestore(&xtime_lock, flags);
 }
 EXPORT_SYMBOL(hardpps);
Index: linux-2.6/kernel/time/timekeeping.c
===================================================================
--- linux-2.6.orig/kernel/time/timekeeping.c
+++ linux-2.6/kernel/time/timekeeping.c
@@ -173,10 +173,12 @@ int __read_mostly timekeeping_suspended;
 /* must hold xtime_lock */
 void timekeeping_leap_insert(int leapsecond)
 {
+	write_seqcount_begin(&xtime_seq);
 	xtime.tv_sec += leapsecond;
 	wall_to_monotonic.tv_sec -= leapsecond;
 	update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
 			timekeeper.mult);
+	write_seqcount_end(&xtime_seq);
 }
 
 /**



  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 ` Thomas Gleixner [this message]
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 ` [patch 3/7] timekeeping: Make seqcount sections smaller Thomas Gleixner
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.531749654@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®