From patchwork Wed Sep 12 00:49:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11339 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 4F9AE23F36 for ; Wed, 12 Sep 2012 00:50:03 +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 0A8A23D18DBD for ; Wed, 12 Sep 2012 00:50:02 +0000 (UTC) Received: by ieak11 with SMTP id k11so1938844iea.11 for ; Tue, 11 Sep 2012 17:50:02 -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=YsUbU09X/uNX5t+nH5qW33YFr5ptAIVw0ExgTqKPG54=; b=WG+XSQWnk3yhKL43/sR3p2M9NPPezQ3oU9HbkArBOWPLE90c5T+0/B++8ate2YHMaz rySFUjwu0H1HmFpESTLSV1B8bCirrWXrQnhepd3h4mtTjHX9cyhC0D1BbIeM4lLWc882 SOnJ4ruZHsg8JQGRevEK1h28dslU6Tv4NePjTssI6UII447xH1blQns+3Qlyc3OmryBI F47RBn3JVqKXaUBnDTzdy4o4J9JJ/WZO8zjYAWUmpYnEHIOnNjLDltZgXIw6EZf3NfCr iHuMWttAdq6/3GEbyflRTzywxVwxlqzgRCR1GC3cYsvlMlK/8u0cYDDFn1YAOWrGXzYo BRXQ== Received: by 10.42.60.139 with SMTP id q11mr23442989ich.53.1347411002430; Tue, 11 Sep 2012 17:50:02 -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 ex8csp42596igc; Tue, 11 Sep 2012 17:50:01 -0700 (PDT) Received: by 10.50.173.100 with SMTP id bj4mr18678470igc.35.1347411001306; Tue, 11 Sep 2012 17:50:01 -0700 (PDT) Received: from e7.ny.us.ibm.com (e7.ny.us.ibm.com. [32.97.182.137]) by mx.google.com with ESMTPS id uk18si5125136igb.32.2012.09.11.17.50.01 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Sep 2012 17:50:01 -0700 (PDT) Received-SPF: neutral (google.com: 32.97.182.137 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.182.137; Authentication-Results: mx.google.com; spf=neutral (google.com: 32.97.182.137 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 e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Sep 2012 20:50:00 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e7.ny.us.ibm.com (192.168.1.107) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 11 Sep 2012 20:49:57 -0400 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id EC091C90045; Tue, 11 Sep 2012 20:49:56 -0400 (EDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8C0nurx11141176; Tue, 11 Sep 2012 20:49:56 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8C0nucN002576; Tue, 11 Sep 2012 20:49:56 -0400 Received: from kernel-pok.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q8C0nu3T002562; Tue, 11 Sep 2012 20:49:56 -0400 From: John Stultz To: stable@vger.kernel.org Cc: John Stultz , Prarit Bhargava , Ingo Molnar , Thomas Gleixner , Linux Kernel Subject: [PATCH 2/3] 3.0.y: time: Avoid making adjustments if we haven't accumulated anything Date: Tue, 11 Sep 2012 20:49:52 -0400 Message-Id: <1347410993-19004-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347410993-19004-1-git-send-email-john.stultz@linaro.org> References: <1347410993-19004-1-git-send-email-john.stultz@linaro.org> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12091200-5806-0000-0000-0000198023A7 X-Gm-Message-State: ALoCoQlVSRUj7DAskLfxKJr835rLXVvS0w12/TO5SV27HrNTQIciVorNn7neessqcbdQ8AlxFfhq 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 bfa6be73..3bbaf2d0 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -919,6 +919,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; /*