Commit d9f0acde authored by Viresh Kumar's avatar Viresh Kumar Committed by Thomas Gleixner

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: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarPreeti U Murthy <preeti@linux.vnet.ibm.com>
Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
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.orgSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 91e5a217
...@@ -887,6 +887,9 @@ static void __remove_hrtimer(struct hrtimer *timer, ...@@ -887,6 +887,9 @@ static void __remove_hrtimer(struct hrtimer *timer,
next_timer = timerqueue_getnext(&base->active); next_timer = timerqueue_getnext(&base->active);
timerqueue_del(&base->active, &timer->node); timerqueue_del(&base->active, &timer->node);
if (!timerqueue_getnext(&base->active))
base->cpu_base->active_bases &= ~(1 << base->index);
if (&timer->node == next_timer) { if (&timer->node == next_timer) {
#ifdef CONFIG_HIGH_RES_TIMERS #ifdef CONFIG_HIGH_RES_TIMERS
/* Reprogram the clock event device. if enabled */ /* Reprogram the clock event device. if enabled */
...@@ -900,8 +903,6 @@ static void __remove_hrtimer(struct hrtimer *timer, ...@@ -900,8 +903,6 @@ static void __remove_hrtimer(struct hrtimer *timer,
} }
#endif #endif
} }
if (!timerqueue_getnext(&base->active))
base->cpu_base->active_bases &= ~(1 << base->index);
out: out:
timer->state = newstate; timer->state = newstate;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment