lkml.org 
[lkml]   [2014]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V2 21/36] hrtimer: create base_on_this_cpu()
Date
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(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 458b952..2d5bb9d 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
@@ -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) {
/*
--
1.7.12.rc2.18.g61b472e


\
 
 \ /
  Last update: 2014-04-04 09:21    [W:0.188 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site