diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-07-03 13:30:20 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-05-14 18:38:08 (GMT) |
commit | 333167248a7ad45da0d91860557bda80c2f52f8f (patch) | |
tree | 01170d1d0630a873bc7f2d138b255db4d2447754 /kernel/timer.c | |
parent | baca589746b2999538fb9afa13bfa3c1d8829d35 (diff) | |
download | linux-fsl-qoriq-333167248a7ad45da0d91860557bda80c2f52f8f.tar.xz |
timers: preempt-rt support
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/timer.c')
-rw-r--r-- | kernel/timer.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index 5f0a85b..d01c1c9 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -1358,7 +1358,17 @@ unsigned long get_next_timer_interrupt(unsigned long now) if (cpu_is_offline(smp_processor_id())) return expires; +#ifdef CONFIG_PREEMPT_RT_FULL + /* + * On PREEMPT_RT we cannot sleep here. If the trylock does not + * succeed then we return the worst-case 'expires in 1 tick' + * value: + */ + if (!spin_trylock(&base->lock)) + return now + 1; +#else spin_lock(&base->lock); +#endif if (base->active_timers) { if (time_before_eq(base->next_timer, base->timer_jiffies)) base->next_timer = __next_timer_interrupt(base); @@ -1368,7 +1378,6 @@ unsigned long get_next_timer_interrupt(unsigned long now) if (time_before_eq(expires, now)) return now; - return cmp_next_hrtimer_event(now, expires); } #endif @@ -1619,7 +1628,7 @@ static void migrate_timers(int cpu) BUG_ON(cpu_online(cpu)); old_base = per_cpu(tvec_bases, cpu); - new_base = get_cpu_var(tvec_bases); + new_base = get_local_var(tvec_bases); /* * The caller is globally serialized and nobody else * takes two locks at once, deadlock is not possible. @@ -1640,7 +1649,7 @@ static void migrate_timers(int cpu) spin_unlock(&old_base->lock); spin_unlock_irq(&new_base->lock); - put_cpu_var(tvec_bases); + put_local_var(tvec_bases); } #endif /* CONFIG_HOTPLUG_CPU */ |