lkml.org 
[lkml]   [2014]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 15/16] 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 | 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


\
 
 \ /
  Last update: 2014-03-28 14:01    [W:0.145 / U:3.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site