From patchwork Mon Jul 23 17:24:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Henriques X-Patchwork-Id: 172721 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id B25282C035E for ; Tue, 24 Jul 2012 03:25:03 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1StMNL-00086T-9T; Mon, 23 Jul 2012 17:24:55 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1StMNB-000803-6f for kernel-team@lists.ubuntu.com; Mon, 23 Jul 2012 17:24:45 +0000 Received: from av-217-129-137-172.netvisao.pt ([217.129.137.172] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1StMNB-00027X-1i for kernel-team@lists.ubuntu.com; Mon, 23 Jul 2012 17:24:45 +0000 From: Luis Henriques To: kernel-team@lists.ubuntu.com Subject: [PATCH 04/11] 2.6.32.x: time: Move common updates to a function Date: Mon, 23 Jul 2012 18:24:32 +0100 Message-Id: <1343064279-28091-5-git-send-email-luis.henriques@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1343064279-28091-1-git-send-email-luis.henriques@canonical.com> References: <1343064279-28091-1-git-send-email-luis.henriques@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Thomas Gleixner BugLink: http://bugs.launchpad.net/bugs/1020285 This is a backport of cc06268c6a87db156af2daed6e96a936b955cc82 While not a bugfix itself, it allows following fixes to backport in a more straightforward manner. CC: Thomas Gleixner CC: Eric Dumazet CC: Richard Cochran Signed-off-by: Thomas Gleixner Cc: Prarit Bhargava Cc: Thomas Gleixner Cc: Linux Kernel Signed-off-by: John Stultz Signed-off-by: Luis Henriques --- kernel/time/timekeeping.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 6d19a00..a969adf 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -166,6 +166,18 @@ static struct timespec total_sleep_time; */ struct timespec raw_time; +/* must hold write on xtime_lock */ +static void timekeeping_update(bool clearntp) +{ + if (clearntp) { + timekeeper.ntp_error = 0; + ntp_clear(); + } + update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult); +} + + + /* flag for if timekeeping is suspended */ int __read_mostly timekeeping_suspended; @@ -341,10 +353,7 @@ int do_settimeofday(struct timespec *tv) update_xtime_cache(0); - timekeeper.ntp_error = 0; - ntp_clear(); - - update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult); + timekeeping_update(true); write_sequnlock_irqrestore(&xtime_lock, flags); @@ -832,8 +841,7 @@ void update_wall_time(void) nsecs = clocksource_cyc2ns(offset, timekeeper.mult, timekeeper.shift); update_xtime_cache(nsecs); - /* check to see if there is a new clocksource to use */ - update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult); + timekeeping_update(false); } /**