mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Richard Cochran <richardcochran@gmail.com>,
	Prarit Bhargava <prarit@redhat.com>
Subject: [PATCH 7/8] timekeeping: Simplify tai updating from do_adjtimex
Date: Mon, 25 Mar 2013 13:08:17 -0700	[thread overview]
Message-ID: <1364242098-5977-8-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1364242098-5977-1-git-send-email-john.stultz@linaro.org>

Since we are taking the timekeeping locks, just go ahead
and update any tai change directly, rather then dropping
the lock and calling a function that will just take it again.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 kernel/time/timekeeping.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index d10bd73..f93f60c 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1618,9 +1618,10 @@ EXPORT_SYMBOL_GPL(ktime_get_monotonic_offset);
  */
 int do_adjtimex(struct timex *txc)
 {
+	struct timekeeper *tk = &timekeeper;
 	unsigned long flags;
 	struct timespec ts;
-	s32 tai, orig_tai;
+	s32 tai;
 	int ret;
 
 	/* Validate the data before disabling interrupts */
@@ -1640,19 +1641,17 @@ int do_adjtimex(struct timex *txc)
 	}
 
 	getnstimeofday(&ts);
-	orig_tai = tai = timekeeping_get_tai_offset();
 
 	raw_spin_lock_irqsave(&timekeeper_lock, flags);
 	write_seqcount_begin(&timekeeper_seq);
 
+	tai = tk->tai_offset;
 	ret = __do_adjtimex(txc, &ts, &tai);
 
+	__timekeeping_set_tai_offset(tk, tai);
 	write_seqcount_end(&timekeeper_seq);
 	raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
 
-	if (tai != orig_tai)
-		timekeeping_set_tai_offset(tai);
-
 	return ret;
 }
 
-- 
1.7.10.4


  parent reply	other threads:[~2013-03-25 20:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-25 20:08 [PATCH 0/8] Move ntp state to be protected by timekeeping lock John Stultz
2013-03-25 20:08 ` [PATCH 1/8] ntp: Split out timex validation from do_adjtimex John Stultz
2013-03-25 20:08 ` [PATCH 2/8] ntp: Move do_adjtimex() and hardpps() functions to timekeeping.c John Stultz
2013-03-25 20:08 ` [PATCH 3/8] ntp: Move timex validation to timekeeping do_adjtimex call John Stultz
2013-03-25 20:08 ` [PATCH 4/8] ntp: Rework do_adjtimex to take timespec and tai arguments John Stultz
2013-03-25 20:08 ` [PATCH 5/8] timekeeping: Move ADJ_SETOFFSET to top level do_adjtimex() John Stultz
2013-03-25 20:08 ` [PATCH 6/8] timekeeping: Hold timekeepering locks in do_adjtimex and hardpps John Stultz
2013-03-25 20:08 ` John Stultz [this message]
2013-03-25 20:08 ` [PATCH 8/8] ntp: Remove ntp_lock, using the timekeeping locks to protect ntp state John Stultz
2013-03-26 19:14 ` [PATCH 0/8] Move ntp state to be protected by timekeeping lock Richard Cochran
2013-03-28 12:54 ` Prarit Bhargava

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=1364242098-5977-8-git-send-email-john.stultz@linaro.org \
    --to=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prarit@redhat.com \
    --cc=richardcochran@gmail.com \
    --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