From patchwork Wed Aug 22 00:30:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10841 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 2D0B923E41 for ; Wed, 22 Aug 2012 00:31:44 +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 C5631A18C9A for ; Wed, 22 Aug 2012 00:31:33 +0000 (UTC) Received: by iadj38 with SMTP id j38so307722iad.11 for ; Tue, 21 Aug 2012 17:31:43 -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=jDu1abcthMT+swgKKxuXbuYe5TnM/t5ST9Btx2aVk6M=; b=cejxLZVBAUMsHTt/1V41cfON4CG9g9pEFwRhXMz2AXMBXXyeJILfeWr5BmqGqA30ll aEyaNmYf/tau482H98dysbkJciGn2+EeE04CAtGerFH2QVkqc+tWE/cXWRuXch10ETse hDouhpmpntsSgD98naG+WoGgLf9VnqC7axZ2r9+WiE5M1GsqgDeuzO8EHDPzL0NNf5nc bcB0j8COXkLvhKmGU1wEUflzPJwwQWQhb3IJ3mKToD2WiaHYUNjA2n7+VfGc0cCPmtZG r3mWC/QRCEI/25U5LwUlE4lxDc2HQDLHWvjqmmTdiv1p1opEpzlHbmVp7Yp3yOOoa03X X9aA== Received: by 10.50.45.162 with SMTP id o2mr413840igm.0.1345595503174; Tue, 21 Aug 2012 17:31:43 -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 ex8csp173763igc; Tue, 21 Aug 2012 17:31:42 -0700 (PDT) Received: by 10.50.195.234 with SMTP id ih10mr366793igc.21.1345595502266; Tue, 21 Aug 2012 17:31:42 -0700 (PDT) Received: from e8.ny.us.ibm.com (e8.ny.us.ibm.com. [32.97.182.138]) by mx.google.com with ESMTPS id ak4si5002526icc.22.2012.08.21.17.31.42 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Aug 2012 17:31:42 -0700 (PDT) Received-SPF: neutral (google.com: 32.97.182.138 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.182.138; Authentication-Results: mx.google.com; spf=neutral (google.com: 32.97.182.138 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 e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 21 Aug 2012 20:31:41 -0400 Received: from d01dlp02.pok.ibm.com (9.56.250.167) by e8.ny.us.ibm.com (192.168.1.108) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 21 Aug 2012 20:30:58 -0400 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 8C0D16E803F; Tue, 21 Aug 2012 20:30:57 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7M0UvEZ092546; Tue, 21 Aug 2012 20:30:57 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7M0UvGf024430; Tue, 21 Aug 2012 21:30:57 -0300 Received: from kernel-pok.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q7M0UuAI024415; Tue, 21 Aug 2012 21:30:57 -0300 From: John Stultz To: linux-kernel Cc: John Stultz , Ingo Molnar , Prarit Bhargava , Thomas Gleixner , stable@vger.kernel.org Subject: [PATCH 4/4] time: Avoid making adjustments if we havne't accumulated anything Date: Tue, 21 Aug 2012 20:30:49 -0400 Message-Id: <1345595449-34965-5-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1345595449-34965-1-git-send-email-john.stultz@linaro.org> References: <1345595449-34965-1-git-send-email-john.stultz@linaro.org> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12082200-9360-0000-0000-000009B13FC3 X-Gm-Message-State: ALoCoQkk5aoLatsResxApMAKBHRcaAc9C6pHsj03Pj4/X0smcbXNxfqTzE7pIV5jQuWLGbXNbuXk 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. Cc: Ingo Molnar Cc: Prarit Bhargava Cc: Thomas Gleixner Cc: stable@vger.kernel.org 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 a5a9389..0c1485e 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1152,6 +1152,10 @@ static void update_wall_time(void) offset = (clock->read(clock) - clock->cycle_last) & clock->mask; #endif + /* Check if there's really nothing to do */ + if (offset < tk->cycle_interval) + goto out; + /* * With NO_HZ we may have to accumulate many cycle_intervals * (think "ticks") worth of time at once. To do this efficiently,