blob: 8fab57877edbb8529d9b4f17d56627234d761daa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
From fffde2620b96f2fe0a337ef2f0d8c9f6a09265fb Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@elte.hu>
Date: Fri, 3 Jul 2009 08:30:20 -0500
Subject: [PATCH 109/274] timers: preempt-rt support
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/timer.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/kernel/timer.c b/kernel/timer.c
index 6857f20..bc165f46 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1346,6 +1346,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);
@@ -1354,7 +1370,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
--
1.7.10.4
|