From patchwork Tue Sep 18 02:32:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11487 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9D7B424183 for ; Tue, 18 Sep 2012 02:32:34 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 12B04A18F37 for ; Tue, 18 Sep 2012 02:32:33 +0000 (UTC) Received: by ieak11 with SMTP id k11so10188882iea.11 for ; Mon, 17 Sep 2012 19:32:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references:x-cbid :x-gm-message-state; bh=GZTxsIKHYR2Bt5ak05FUsYrHm71icRi789b9X0f2SkY=; b=FKF82nNOAX2fBPpy/5OZg+memMFNZepySvXynILOAfHeRZP3/xGgSyZVlwrDtRPVqa jctm4+QCLS+Q2Oyh3Sae4EktxMIPw5VLdFi+2qPR5pvweQBvCeHS/F0tWGtRWG2omqhB IFkTH6syuGYR4x6V8FDu12uSh/Kp9ovH1svvQg9BbAPL12HGeFy6Jggf5ogiEnrBcH/u /4UKVtUeGTDHT8SU3h+6176ilMDdn38/HX1M3aBAJNdKlZzCMcyaMSCE0kAN0+suddK6 GTKZzzhXnDhgqZBn/wZ0c7KkWO95Nq3hsaLOqHTbnDi+wu+iu6nt7DW3yyIVkssAFtcj zEpg== Received: by 10.50.191.227 with SMTP id hb3mr8818514igc.43.1347935553495; Mon, 17 Sep 2012 19:32:33 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp349588igc; Mon, 17 Sep 2012 19:32:33 -0700 (PDT) Received: by 10.50.186.132 with SMTP id fk4mr8955491igc.41.1347935552884; Mon, 17 Sep 2012 19:32:32 -0700 (PDT) Received: from e4.ny.us.ibm.com (e4.ny.us.ibm.com. [32.97.182.144]) by mx.google.com with ESMTPS id nz8si12871475igc.45.2012.09.17.19.32.32 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Sep 2012 19:32:32 -0700 (PDT) Received-SPF: neutral (google.com: 32.97.182.144 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.182.144; Authentication-Results: mx.google.com; spf=neutral (google.com: 32.97.182.144 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) smtp.mail=john.stultz@linaro.org Received: from /spool/local by e4.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 17 Sep 2012 22:32:31 -0400 Received: from d01relay01.pok.ibm.com (9.56.227.233) by e4.ny.us.ibm.com (192.168.1.104) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 17 Sep 2012 22:32:17 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8I2WGBV146338; Mon, 17 Sep 2012 22:32:16 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8I2WG4U008741; Mon, 17 Sep 2012 23:32:16 -0300 Received: from kernel-pok.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q8I2WDhH008571; Mon, 17 Sep 2012 23:32:16 -0300 From: John Stultz To: stable@vger.kernel.org Cc: John Stultz , Prarit Bhargava , Ingo Molnar , Thomas Gleixner , Linux Kernel Subject: [PATCH 2/3] 2.6.32.y: time: Avoid making adjustments if we haven't accumulated anything Date: Mon, 17 Sep 2012 22:32:09 -0400 Message-Id: <1347935530-33767-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347935530-33767-1-git-send-email-john.stultz@linaro.org> References: <1347935530-33767-1-git-send-email-john.stultz@linaro.org> x-cbid: 12091802-3534-0000-0000-00000CD663CC X-Gm-Message-State: ALoCoQm+FPrm+91Zv9lGojrieeANj05z47oRmSYbo1mcySoyzX6KKWZtySGvA1TQsfPs2T4g++My This is a -stable backport of bf2ac312195155511a0f79325515cbb61929898a If update_wall_time() is called and the current offset isn't large enough to accumulate, avoid re-calling timekeeping_adjust which may change the clock freq and can cause 1ns inconsistencies with CLOCK_REALTIME_COARSE/CLOCK_MONOTONIC_COARSE. Signed-off-by: John Stultz Cc: Prarit Bhargava Cc: Ingo Molnar Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/1345595449-34965-5-git-send-email-john.stultz@linaro.org Signed-off-by: Thomas Gleixner Cc: Linux Kernel Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 85d51c4..b451c93 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -807,6 +807,10 @@ void update_wall_time(void) #else offset = timekeeper.cycle_interval; #endif + /* Check if there's really nothing to do */ + if (offset < timekeeper.cycle_interval) + return; + timekeeper.xtime_nsec = (s64)xtime.tv_nsec << timekeeper.shift; /* normally this loop will run just once, however in the