From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757962AbbDVTFw (ORCPT ); Wed, 22 Apr 2015 15:05:52 -0400 Received: from terminus.zytor.com ([198.137.202.10]:41128 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757517AbbDVTFm (ORCPT ); Wed, 22 Apr 2015 15:05:42 -0400 Date: Wed, 22 Apr 2015 12:04:47 -0700 From: tip-bot for Viresh Kumar Message-ID: Cc: hpa@zytor.com, peterz@infradead.org, fweisbec@gmail.com, preeti@linux.vnet.ibm.com, tglx@linutronix.de, viresh.kumar@linaro.org, mtosatti@redhat.com, linux-kernel@vger.kernel.org, mingo@kernel.org Reply-To: tglx@linutronix.de, viresh.kumar@linaro.org, mingo@kernel.org, linux-kernel@vger.kernel.org, mtosatti@redhat.com, hpa@zytor.com, peterz@infradead.org, fweisbec@gmail.com, preeti@linux.vnet.ibm.com In-Reply-To: References: <20150414203500.533438642@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] hrtimer: Update active_bases before calling hrtimer_force_reprogram() Git-Commit-ID: d9f0acdeef48570c4e6159d3108f12b64571392e X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: d9f0acdeef48570c4e6159d3108f12b64571392e Gitweb: http://git.kernel.org/tip/d9f0acdeef48570c4e6159d3108f12b64571392e Author: Viresh Kumar AuthorDate: Tue, 14 Apr 2015 21:08:25 +0000 Committer: Thomas Gleixner CommitDate: Wed, 22 Apr 2015 17:06:48 +0200 hrtimer: Update active_bases before calling hrtimer_force_reprogram() '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 ] Signed-off-by: Viresh Kumar Reviewed-by: Preeti U Murthy Acked-by: Peter Zijlstra Cc: Marcelo Tosatti Cc: Frederic Weisbecker Cc: linaro-kernel@lists.linaro.org Link: http://lkml.kernel.org/r/20150414203500.533438642@linutronix.de 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(-) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index b1a74ee..9abd50b 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -887,6 +887,9 @@ static void __remove_hrtimer(struct hrtimer *timer, 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 */ @@ -900,8 +903,6 @@ static void __remove_hrtimer(struct hrtimer *timer, } #endif } - if (!timerqueue_getnext(&base->active)) - base->cpu_base->active_bases &= ~(1 << base->index); out: timer->state = newstate; }