From patchwork Mon Apr 14 16:23:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 28357 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9257F20534 for ; Mon, 14 Apr 2014 16:36:36 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id j7sf24549318qaq.10 for ; Mon, 14 Apr 2014 09:36:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=WyxdoH/7E1vgrKauEHwy8zABDRumfTB1+CLgc2PAXxg=; b=duuoIuMQsSm+KZu3z522dPKlVACeLZxlIxBULqsiw6WQxmLLgG4Laz3KdATPn8+9D2 QPNGOmPt66k02yaXYcEzFFKgiAzN2cjSrre4bZg+/q3AsTCcM27DHl5i/5dmRdiCen3+ 2nDqfqVXcmRsBFQzP2qHjlQjSMHQHwavc/P8iogOhYWg+5d4Ko4bJqoUmdB84l5z4T0z 1N6pnL5m6yy0ErQZD2X1bmhipLOLSJT0TYLRrFAPzs0WkgASU6UzcENJ5arQiRlDc8dN qfHrkxVtKhIBzMbIU+j/6oxOeJU+yiYgIv/hBN57bxMlivRFvcrGu8WsT5fBsLAKmX/U AJzw== X-Gm-Message-State: ALoCoQmOSdw/nQChXNYh24d632RDsQhVyoV2rFQjCV7EhN7oJPCoLXQASM9aethEyx0ea5WrNWIo X-Received: by 10.58.105.65 with SMTP id gk1mr19864325veb.28.1397493396281; Mon, 14 Apr 2014 09:36:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.107 with SMTP id b98ls1705053qgd.64.gmail; Mon, 14 Apr 2014 09:36:36 -0700 (PDT) X-Received: by 10.52.104.33 with SMTP id gb1mr632604vdb.45.1397493396145; Mon, 14 Apr 2014 09:36:36 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id fx7si2835210vcb.153.2014.04.14.09.36.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:36:36 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id im17so7683766vcb.37 for ; Mon, 14 Apr 2014 09:36:36 -0700 (PDT) X-Received: by 10.52.165.105 with SMTP id yx9mr31424352vdb.22.1397493396054; Mon, 14 Apr 2014 09:36:36 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp163570vcb; Mon, 14 Apr 2014 09:36:35 -0700 (PDT) X-Received: by 10.68.234.2 with SMTP id ua2mr45294873pbc.81.1397493395294; Mon, 14 Apr 2014 09:36:35 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si9164636paw.209.2014.04.14.09.36.34; Mon, 14 Apr 2014 09:36:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755778AbaDNQ1M (ORCPT + 26 others); Mon, 14 Apr 2014 12:27:12 -0400 Received: from mail-pb0-f52.google.com ([209.85.160.52]:51518 "EHLO mail-pb0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755749AbaDNQ1J (ORCPT ); Mon, 14 Apr 2014 12:27:09 -0400 Received: by mail-pb0-f52.google.com with SMTP id rr13so8435467pbb.39 for ; Mon, 14 Apr 2014 09:27:09 -0700 (PDT) X-Received: by 10.66.136.131 with SMTP id qa3mr44924066pab.77.1397492829310; Mon, 14 Apr 2014 09:27:09 -0700 (PDT) Received: from localhost ([122.167.126.16]) by mx.google.com with ESMTPSA id sy1sm82405054pab.30.2014.04.14.09.27.06 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:27:08 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, Arvind.Chauhan@arm.com, linaro-networking@linaro.org, Viresh Kumar , John Stultz Subject: [PATCH 26/38] tick-sched: don't call update_wall_time() when delta is lesser than tick_period Date: Mon, 14 Apr 2014 21:53:48 +0530 Message-Id: <8cf944ba5c78a47f83db9391f423150202816e61.1397492345.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In tick_do_update_jiffies64() we are processing ticks only if delta is greater than tick_period. This is what we are supposed to do here and it broke a bit with this patch: commit 47a1b796306356f358e515149d86baf0cc6bf007 Author: John Stultz Date: Thu Dec 12 13:10:55 2013 -0800 tick/timekeeping: Call update_wall_time outside the jiffies lock With above patch, we might end up calling update_wall_time() even if delta is found to be smaller that tick_period. Fix this by reversing the check and returning early. Cc: John Stultz Signed-off-by: Viresh Kumar --- kernel/time/tick-sched.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index b7b09b9..bff7f97 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -65,26 +65,28 @@ static void tick_do_update_jiffies64(ktime_t now) write_seqlock(&jiffies_lock); delta = ktime_sub(now, last_jiffies_update); - if (delta.tv64 >= tick_period.tv64) { - - delta = ktime_sub(delta, tick_period); - last_jiffies_update = ktime_add(last_jiffies_update, - tick_period); + if (delta.tv64 < tick_period.tv64) { + write_sequnlock(&jiffies_lock); + return; + } - /* Slow path for long timeouts */ - if (unlikely(delta.tv64 >= tick_period.tv64)) { - s64 incr = ktime_to_ns(tick_period); + delta = ktime_sub(delta, tick_period); + last_jiffies_update = ktime_add(last_jiffies_update, tick_period); - ticks = ktime_divns(delta, incr); + /* Slow path for long timeouts */ + if (unlikely(delta.tv64 >= tick_period.tv64)) { + s64 incr = ktime_to_ns(tick_period); - last_jiffies_update = ktime_add_ns(last_jiffies_update, - incr * ticks); - } - do_timer(++ticks); + ticks = ktime_divns(delta, incr); - /* Keep the tick_next_period variable up to date */ - tick_next_period = ktime_add(last_jiffies_update, tick_period); + last_jiffies_update = ktime_add_ns(last_jiffies_update, + incr * ticks); } + do_timer(++ticks); + + /* Keep the tick_next_period variable up to date */ + tick_next_period = ktime_add(last_jiffies_update, tick_period); + write_sequnlock(&jiffies_lock); update_wall_time(); }