From patchwork Tue Sep 18 01:38:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11482 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 63B4D24182 for ; Tue, 18 Sep 2012 01:38:56 +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 B9931A18471 for ; Tue, 18 Sep 2012 01:38:55 +0000 (UTC) Received: by ieak11 with SMTP id k11so10130412iea.11 for ; Mon, 17 Sep 2012 18:38:55 -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=LxaJsTzyqhZYG2J5qkOOhxdzjTbsQY8bDtM8jLDMkuI=; b=gk8ZCBp/9In7dSsrOLm2IW7vsti+85JJiN2H59i7MHVHQ99jYaTQ+xBhtd6xjkjxMt q41f7a2KDgW404zqlxDEi4lfdQLxQQV8FWj7Ba/ftB4QsVtLm3Lv87rW4b4JRkK8rPIA N+T6GD7SWQcTBJeVFG/GL9s6JcQ8hMu7QACHGWXq9MO2v3qRBmGrzP+EJF2xIqNRLo48 vxYhZPFdcBJTI570i8P+RvfFkeiGI/iHWx2pY9bWq7eVPVfxSnNwrKWxnrlsec+g8PD+ aJgwj0HL7VjUnntFadC2V9NqnfBJ1xqaBvO8vQwHIjw2QBu54sZZLhjLT+xE6HvD+rep gKQg== Received: by 10.50.217.227 with SMTP id pb3mr8853473igc.28.1347932334877; Mon, 17 Sep 2012 18:38:54 -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 ex8csp348172igc; Mon, 17 Sep 2012 18:38:54 -0700 (PDT) Received: by 10.50.196.199 with SMTP id io7mr8897314igc.59.1347932333859; Mon, 17 Sep 2012 18:38:53 -0700 (PDT) Received: from e1.ny.us.ibm.com (e1.ny.us.ibm.com. [32.97.182.141]) by mx.google.com with ESMTPS id kh9si12729892igc.72.2012.09.17.18.38.53 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Sep 2012 18:38:53 -0700 (PDT) Received-SPF: neutral (google.com: 32.97.182.141 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.182.141; Authentication-Results: mx.google.com; spf=neutral (google.com: 32.97.182.141 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 e1.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 17 Sep 2012 21:38:53 -0400 Received: from d01relay05.pok.ibm.com (9.56.227.237) by e1.ny.us.ibm.com (192.168.1.101) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 17 Sep 2012 21:38:51 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8I1co3R155246; Mon, 17 Sep 2012 21:38:50 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8I1coNn029967; Mon, 17 Sep 2012 21:38:50 -0400 Received: from kernel-pok.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q8I1co9W029955; Mon, 17 Sep 2012 21:38:50 -0400 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.34.y: time: Avoid making adjustments if we haven't accumulated anything Date: Mon, 17 Sep 2012 21:38:46 -0400 Message-Id: <1347932327-33192-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347932327-33192-1-git-send-email-john.stultz@linaro.org> References: <1347932327-33192-1-git-send-email-john.stultz@linaro.org> x-cbid: 12091801-6078-0000-0000-00000FB1FDE3 X-Gm-Message-State: ALoCoQmtu2rUMkGxijSYkySKH/exCBQwGfX4vFnZHsC4sxXdS5RKVhCP5jBfQ2toC7xK2FSiLpiW 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 0d59077..bbdad71a 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -849,6 +849,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; /*