From patchwork Tue Sep 11 18:56:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11329 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 CA98D23EFE for ; Tue, 11 Sep 2012 18:56:59 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 599223D018A4 for ; Tue, 11 Sep 2012 18:56:59 +0000 (UTC) Received: by iafj25 with SMTP id j25so636826iaf.11 for ; Tue, 11 Sep 2012 11:56:58 -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-content-scanned:x-cbid:x-ibm-iss-spamdetectors :x-ibm-iss-detailinfo:x-gm-message-state; bh=4cpZgZls1VV7ZeTFyTkniT/GD44BBF+uu7QdzeWFzg8=; b=bHqM5/buUlzU3wChX878SWKELhkkOMdZ5NJwaiqvSbWlWgTB24H8dcErJuIv50hmBU 7ADzbSCQODJifAdZ4A+YzKIEsap/fe2eL+BZXhosi8LXiQjDY7dPWFhlQzIvh+s8AO2J lz3XT3IoHSiz8HIDdeEX6NS84LVl/bSomkSc4Q52yW7QKGZFipwdjxw7bHW50aLdYjvI vwZFMVce+KyyTIPTMZgKhv2CTFGQ70J8i7qklxy6dfSG3ZRXmT3BDz1pVxQiWVDQ0wWf eFEN3SsKbvNhgl6us3iBrSqSOxQJQkuXSKDU7tgWcjCEd9azu1DNiaqjeymabz3LBzzr yt+A== Received: by 10.50.207.106 with SMTP id lv10mr18312304igc.0.1347389818660; Tue, 11 Sep 2012 11:56:58 -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 ex8csp29019igc; Tue, 11 Sep 2012 11:56:58 -0700 (PDT) Received: by 10.236.161.165 with SMTP id w25mr17252674yhk.22.1347389817909; Tue, 11 Sep 2012 11:56:57 -0700 (PDT) Received: from e33.co.us.ibm.com (e33.co.us.ibm.com. [32.97.110.151]) by mx.google.com with ESMTPS id g37si7217255anp.185.2012.09.11.11.56.57 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Sep 2012 11:56:57 -0700 (PDT) Received-SPF: neutral (google.com: 32.97.110.151 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.110.151; Authentication-Results: mx.google.com; spf=neutral (google.com: 32.97.110.151 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 e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Sep 2012 12:56:56 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 11 Sep 2012 12:56:54 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 232293E40044; Tue, 11 Sep 2012 12:56:51 -0600 (MDT) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8BIulic192220; Tue, 11 Sep 2012 12:56:48 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8BIubSA019597; Tue, 11 Sep 2012 12:56:38 -0600 Received: from kernel-pok.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q8BIuYWv019122; Tue, 11 Sep 2012 12:56:36 -0600 From: John Stultz To: stable@vger.kernel.org Cc: John Stultz , Prarit Bhargava , Ingo Molnar , Thomas Gleixner , Linux Kernel Subject: [PATCH 2/3] 3.5.y: time: Avoid making adjustments if we haven't accumulated anything Date: Tue, 11 Sep 2012 14:56:20 -0400 Message-Id: <1347389781-54602-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347389781-54602-1-git-send-email-john.stultz@linaro.org> References: <1347389781-54602-1-git-send-email-john.stultz@linaro.org> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12091118-2398-0000-0000-00000AB4E3C6 X-IBM-ISS-SpamDetectors: X-IBM-ISS-DetailInfo: BY=3.00000294; HX=3.00000196; KW=3.00000007; PH=3.00000001; SC=3.00000007; SDB=6.00173277; UDB=6.00039254; UTC=2012-09-11 18:56:55 X-Gm-Message-State: ALoCoQnc0bsptxx+PIPkL8odmBzGD9h85rfTmEKIMQOLz09zEZ9Fl42LnokN/1KfrcRrhGqaiznJ 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 fd06ae8..df9447b 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1055,6 +1055,10 @@ static void update_wall_time(void) #else offset = (clock->read(clock) - clock->cycle_last) & clock->mask; #endif + /* Check if there's really nothing to do */ + if (offset < timekeeper.cycle_interval) + goto out; + timekeeper.xtime_nsec = (s64)timekeeper.xtime.tv_nsec << timekeeper.shift;