From patchwork Tue Sep 11 19:04:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11333 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 18C5D23F22 for ; Tue, 11 Sep 2012 19:05:38 +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 864F83D01A6F for ; Tue, 11 Sep 2012 19:05:37 +0000 (UTC) Received: by ieak11 with SMTP id k11so1469777iea.11 for ; Tue, 11 Sep 2012 12:05:37 -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=zNhPZ13RBZEFfcDvx9WUdZRnTOGjG/345SHgf4QvIN0=; b=obBEh5qcIKcrsST79nShgkNkvCUdmBOWZs1MGJ2U5Nj9Agrp6gcBbaAuWUilMLmfv+ Q548gX6k4ogifsNt1mKvfpti6+EW6UUWMSFiV6zV6lYOCUnsXUlgeyRWALweeOrHrqA1 5viBtXn0Npp+52pvIUbzQ4J23xaJdbXh6e1gS58XQRJWeUYYAIp1IIPtoP06+oHZPFJj 7ZgiK9N1QPbOC1BSWyMMfUO2ozsYyG7nlqW+Wwa75N/mCN6lcNBIs/COa4bcBeQlWQjz RD+Hi+fVd/NqAFDRac+BX3BHgR02IoLOaUnX8CyBAnUEVGMIfsPfx9wpN4pjRrElql29 T3iA== Received: by 10.50.242.3 with SMTP id wm3mr17511022igc.0.1347390336856; Tue, 11 Sep 2012 12:05:36 -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 ex8csp29296igc; Tue, 11 Sep 2012 12:05:36 -0700 (PDT) Received: by 10.101.125.14 with SMTP id c14mr5312821ann.17.1347390335766; Tue, 11 Sep 2012 12:05:35 -0700 (PDT) Received: from e9.ny.us.ibm.com (e9.ny.us.ibm.com. [32.97.182.139]) by mx.google.com with ESMTPS id j49si16462016yhl.107.2012.09.11.12.05.35 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Sep 2012 12:05:35 -0700 (PDT) Received-SPF: neutral (google.com: 32.97.182.139 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.182.139; Authentication-Results: mx.google.com; spf=neutral (google.com: 32.97.182.139 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 e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Sep 2012 15:05:35 -0400 Received: from d01dlp02.pok.ibm.com (9.56.250.167) by e9.ny.us.ibm.com (192.168.1.109) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 11 Sep 2012 15:05:33 -0400 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 8C8476E803A; Tue, 11 Sep 2012 15:05:28 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8BJ5SfL128224; Tue, 11 Sep 2012 15:05:28 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8BJ4R27016741; Tue, 11 Sep 2012 16:04:28 -0300 Received: from kernel-pok.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q8BJ4Mau015936; Tue, 11 Sep 2012 16:04:22 -0300 From: John Stultz To: stable@vger.kernel.org Cc: John Stultz , Prarit Bhargava , Ingo Molnar , Thomas Gleixner , Linux Kernel Subject: [PATCH 2/3] 3.4.y: time: Avoid making adjustments if we haven't accumulated anything Date: Tue, 11 Sep 2012 15:04:18 -0400 Message-Id: <1347390259-54838-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347390259-54838-1-git-send-email-john.stultz@linaro.org> References: <1347390259-54838-1-git-send-email-john.stultz@linaro.org> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12091119-7182-0000-0000-000002970E5A X-Gm-Message-State: ALoCoQnfsUErUYtivFrd9RHK4utGtntK/WD5n0AnXKDkmC29sjU7K2XnanvpJssR7F19CQGOcJrO 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index dd31d0e..104d549 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1057,9 +1057,12 @@ 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; - /* * With NO_HZ we may have to accumulate many cycle_intervals * (think "ticks") worth of time at once. To do this efficiently,