@@ -107,6 +107,10 @@ static inline int hrtimer_clockid_to_base(clockid_t clock_id)
return hrtimer_clock_to_base_table[clock_id];
}
+static inline bool base_on_this_cpu(struct hrtimer_clock_base *base)
+{
+ return base->cpu_base == &__get_cpu_var(hrtimer_bases);
+}
/*
* Get the coarse grained time at the softirq based on xtime and
@@ -933,8 +937,7 @@ remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base)
* move the timer base in switch_hrtimer_base.
*/
state = timer->state & HRTIMER_STATE_CALLBACK;
- __remove_hrtimer(timer, base, state,
- base->cpu_base == &__get_cpu_var(hrtimer_bases));
+ __remove_hrtimer(timer, base, state, base_on_this_cpu(base));
return 1;
}
@@ -980,7 +983,7 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
*
* XXX send_remote_softirq() ?
*/
- if (leftmost && new_base->cpu_base == &__get_cpu_var(hrtimer_bases)
+ if (leftmost && base_on_this_cpu(new_base)
&& hrtimer_enqueue_reprogram(timer, new_base)) {
if (wakeup) {
/*
We had this code at two places to find if a clock base belongs to current CPU: base->cpu_base == &__get_cpu_var(hrtimer_bases) Better to get a inlined routine for that. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- kernel/hrtimer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)