From patchwork Tue Sep 11 22:35:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11334 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 04B4123EFC for ; Tue, 11 Sep 2012 22:35:40 +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 71F813D09B97 for ; Tue, 11 Sep 2012 22:35:39 +0000 (UTC) Received: by ieak11 with SMTP id k11so1790279iea.11 for ; Tue, 11 Sep 2012 15:35:38 -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-gm-message-state; bh=EvTtDpoIbR5ySlnssPjG5FOHFprO6C6cmkRwgPbqX1s=; b=MK8yv9E+jehk9sNiTdm+Z6JDfFBckdkQxhP+KXLlpLQTF+BCsIK5W3zCVxaW4fCBHY /qio6tmN2OLglygLmWBfZuSf2wh2mkkUCH04ZGhbA/H2MDRHvJ9QDYnzQyV/lT38wKTH 4c7+I5f3V5BVmPaEi4fg1HOVy98hzb27sysKkIYOY9VBHgoX+fkj6RTKzNyzlvZQcoXp xrTDsN9WEh9s2quVgC21nJjuNADEC1f3POMr1EJSDi4geORbtWhbajLeSEoQmY+h+vA6 0nsodlCU/fcjjExvl9FD0/t2LdOFPXmK2YCA0MVxOy115S2rUsS8jJtkWV6YyyzwXhvG hPSA== Received: by 10.50.242.3 with SMTP id wm3mr18133861igc.0.1347402938687; Tue, 11 Sep 2012 15:35:38 -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 ex8csp38391igc; Tue, 11 Sep 2012 15:35:38 -0700 (PDT) Received: by 10.60.29.229 with SMTP id n5mr19786957oeh.103.1347402937454; Tue, 11 Sep 2012 15:35:37 -0700 (PDT) Received: from e36.co.us.ibm.com (e36.co.us.ibm.com. [32.97.110.154]) by mx.google.com with ESMTPS id lg5si23949572obb.2.2012.09.11.15.35.37 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Sep 2012 15:35:37 -0700 (PDT) Received-SPF: neutral (google.com: 32.97.110.154 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.110.154; Authentication-Results: mx.google.com; spf=neutral (google.com: 32.97.110.154 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 e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Sep 2012 16:35:36 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 11 Sep 2012 16:35:35 -0600 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id A6B3819D8041; Tue, 11 Sep 2012 16:35:34 -0600 (MDT) Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8BMZYRI213846; Tue, 11 Sep 2012 16:35:34 -0600 Received: from d03av05.boulder.ibm.com (loopback [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8BMZW5Y009838; Tue, 11 Sep 2012 16:35:32 -0600 Received: from kernel-pok.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q8BMZT6Z009728; Tue, 11 Sep 2012 16:35:31 -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.2.y: time: Avoid making adjustments if we haven't accumulated anything Date: Tue, 11 Sep 2012 18:35:25 -0400 Message-Id: <1347402926-34813-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347402926-34813-1-git-send-email-john.stultz@linaro.org> References: <1347402926-34813-1-git-send-email-john.stultz@linaro.org> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12091122-7606-0000-0000-00000393A1DC X-Gm-Message-State: ALoCoQlS2/ClE439GBOCPq7929YoZpoDDauBIvNtckbEBMUNtXoB+dz+nV9SYjmOgfhnWKUd07GQ 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 36440c88..59544dc 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1033,6 +1033,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) + return; + timekeeper.xtime_nsec = (s64)xtime.tv_nsec << timekeeper.shift; /*