diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-07-03 08:30:20 -0500 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2012-04-10 16:40:28 -0500 |
commit | 8dfcdef7060ecc62f9570b38cba08bf71d6e47c8 (patch) | |
tree | 82aed94af742d690b189b0d32c382a227d2c4b9a | |
parent | b0d7126e39527573743397bb63ef9473d46f2a6b (diff) |
timers: preempt-rt support
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | kernel/timer.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index d7ad9d00cc62..05cee31d915f 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -1344,6 +1344,22 @@ unsigned long get_next_timer_interrupt(unsigned long now) */ if (cpu_is_offline(smp_processor_id())) return now + NEXT_TIMER_MAX_DELTA; + +#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)) { + if (time_before_eq(base->next_timer, base->timer_jiffies)) + base->next_timer = __next_timer_interrupt(base); + expires = base->next_timer; + spin_unlock(&base->lock); + } else { + expires = now + 1; + } +#else spin_lock(&base->lock); if (time_before_eq(base->next_timer, base->timer_jiffies)) base->next_timer = __next_timer_interrupt(base); @@ -1352,7 +1368,7 @@ unsigned long get_next_timer_interrupt(unsigned long now) if (time_before_eq(expires, now)) return now; - +#endif return cmp_next_hrtimer_event(now, expires); } #endif |