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.ku...@linaro.org>
---
 kernel/hrtimer.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 5d77f36..83e5f2d 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -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
@@ -916,8 +920,7 @@ static inline int remove_hrtimer(struct hrtimer *timer)
         * move the timer base in switch_hrtimer_base.
         */
        state = timer->state & HRTIMER_STATE_CALLBACK;
-       __remove_hrtimer(timer, state,
-                       timer->base->cpu_base == &__get_cpu_var(hrtimer_bases));
+       __remove_hrtimer(timer, state, base_on_this_cpu(timer->base));
        return 1;
 }
 
@@ -964,9 +967,8 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t 
tim,
         *
         * XXX send_remote_softirq() ?
         */
-       if (hrtimer_is_leftmost(timer) &&
-           new_base->cpu_base == &__get_cpu_var(hrtimer_bases)
-               && hrtimer_enqueue_reprogram(timer)) {
+       if (hrtimer_is_leftmost(timer) && base_on_this_cpu(new_base) &&
+           hrtimer_enqueue_reprogram(timer)) {
                if (wakeup) {
                        /*
                         * We need to drop cpu_base->lock to avoid a
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to