From patchwork Tue Apr 14 21:08:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 47151 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E719220553 for ; Tue, 14 Apr 2015 21:08:22 +0000 (UTC) Received: by lbbqq2 with SMTP id qq2sf5210424lbb.0 for ; Tue, 14 Apr 2015 14:08:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:user-agent:date:from:to :cc:subject:references:mime-version:content-type:content-disposition :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=tzDzgorFYG/WnzYMXZOwaVnNjQav8EG1ZOI5kq2be6c=; b=mzFjvLJ5UPvls7UyaueJR2AWyTC3Q+5tLyQ61190MhAB3FYKvo7KDL+iZEatgYiQ3n gi0seTnU+Kf8dzzI8JuUYHNFkarT7M5neDWLyGXghQecGaToSvJhCy94yAAxqj7vajpJ lofzrO9tD2zWAuJKU+nyluFGh2bV8hpNkz7wOCFx8ho/V29LxB3Vycq1dVqtspRP9OGe hpknPySP4wPC7DrlozIfdp7ETszHg80mz91uShe7NEzKiFLjPIenc10zmPXKyixk3RF9 VNmS8xaMQQQrLa23eWoL1bomj/3wN0fUUneBnS5VoV5KTOwFFfX5DP9veEzzAiZyaO+s nwVg== X-Gm-Message-State: ALoCoQnNtre71q7T1r4j12HmvZ3VvrTNUuysNyU/sVX8hRgQUaSQJg5wE33bTl3FFg6D58HFoZZn X-Received: by 10.112.122.39 with SMTP id lp7mr3554295lbb.5.1429045701740; Tue, 14 Apr 2015 14:08:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.72 with SMTP id b8ls124411laf.81.gmail; Tue, 14 Apr 2015 14:08:21 -0700 (PDT) X-Received: by 10.112.160.41 with SMTP id xh9mr20281874lbb.96.1429045701497; Tue, 14 Apr 2015 14:08:21 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id b17si2105367lbo.82.2015.04.14.14.08.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Apr 2015 14:08:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbbuc2 with SMTP id uc2so18989922lbb.2 for ; Tue, 14 Apr 2015 14:08:21 -0700 (PDT) X-Received: by 10.152.28.5 with SMTP id x5mr20405509lag.112.1429045701216; Tue, 14 Apr 2015 14:08:21 -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.112.67.65 with SMTP id l1csp2124836lbt; Tue, 14 Apr 2015 14:08:19 -0700 (PDT) X-Received: by 10.70.91.225 with SMTP id ch1mr40177645pdb.65.1429045698839; Tue, 14 Apr 2015 14:08:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hg5si3542086pac.34.2015.04.14.14.08.17; Tue, 14 Apr 2015 14:08:18 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755110AbbDNVIM (ORCPT + 27 others); Tue, 14 Apr 2015 17:08:12 -0400 Received: from www.linutronix.de ([62.245.132.108]:37861 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754776AbbDNVIE (ORCPT ); Tue, 14 Apr 2015 17:08:04 -0400 Received: from localhost ([127.0.0.1] helo=[127.0.1.1]) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1Yi83u-00043e-LP; Tue, 14 Apr 2015 23:08:02 +0200 Message-Id: <20150414203500.533438642@linutronix.de> User-Agent: quilt/0.63-1 Date: Tue, 14 Apr 2015 21:08:25 -0000 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Ingo Molnar , Preeti U Murthy , Viresh Kumar , Marcelo Tosatti , Frederic Weisbecker , linaro-kernel@lists.linaro.org Subject: [patch 01/39] hrtimer: Update active_bases before calling hrtimer_force_reprogram() References: <20150414203303.702062272@linutronix.de> MIME-Version: 1.0 Content-Disposition: inline; filename=hrtimer-move-update-active-bases.patch X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1, SHORTCIRCUIT=-0.0001, URIBL_BLOCKED=0.001 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: tglx@linutronix.de X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) 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: , From: Viresh Kumar 'active_bases' indicates which clock-base have active timer. The intention of this bit field was to avoid evaluating inactive bases. It was introduced with the introduction of the BOOTTIME and TAI clock bases, but it was never brought into full use. We want to use it now, but in __remove_hrtimer() the update happens after the calling hrtimer_force_reprogram() which has to evaluate all clock bases for the next expiring timer. So in case the last timer of a clock base got removed we still see the active bit and therefor evaluate the clock base for no value. There are further optimizations possible when active_bases is updated in the right place. Move the update before the call to hrtimer_force_reprogram() [ tglx: Massaged changelog ] Reviewed-by: Preeti U Murthy Signed-off-by: Viresh Kumar Cc: linaro-kernel@lists.linaro.org Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/c7c8ebcd9ed88bb09d76059c745a1fafb48314e7.1428039899.git.viresh.kumar@linaro.org Signed-off-by: Thomas Gleixner --- kernel/time/hrtimer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ Index: tip/kernel/time/hrtimer.c =================================================================== --- tip.orig/kernel/time/hrtimer.c +++ tip/kernel/time/hrtimer.c @@ -879,6 +879,9 @@ static void __remove_hrtimer(struct hrti next_timer = timerqueue_getnext(&base->active); timerqueue_del(&base->active, &timer->node); + if (!timerqueue_getnext(&base->active)) + base->cpu_base->active_bases &= ~(1 << base->index); + if (&timer->node == next_timer) { #ifdef CONFIG_HIGH_RES_TIMERS /* Reprogram the clock event device. if enabled */ @@ -892,8 +895,6 @@ static void __remove_hrtimer(struct hrti } #endif } - if (!timerqueue_getnext(&base->active)) - base->cpu_base->active_bases &= ~(1 << base->index); out: timer->state = newstate; }