diff options
author | Tony Lindgren <tony@atomide.com> | 2006-03-06 18:42:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-06 21:40:44 -0500 |
commit | 69239749e1ac4f3496906aa4267cb9f61ce52c9c (patch) | |
tree | c64bc2c254b7fa81b50b11c851fe5c86ecdd83c1 /kernel/timer.c | |
parent | f7c09bd972b7111b8c69bf57a189571edd4d4a7d (diff) |
[PATCH] fix next_timer_interrupt() for hrtimer
Also from Thomas Gleixner <tglx@linutronix.de>
Function next_timer_interrupt() got broken with a recent patch
6ba1b91213e81aa92b5cf7539f7d2a94ff54947c as sys_nanosleep() was moved to
hrtimer. This broke things as next_timer_interrupt() did not check hrtimer
tree for next event.
Function next_timer_interrupt() is needed with dyntick (CONFIG_NO_IDLE_HZ,
VST) implementations, as the system can be in idle when next hrtimer event
was supposed to happen. At least ARM and S390 currently use
next_timer_interrupt().
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/timer.c')
-rw-r--r-- | kernel/timer.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index fc6646fd5aab..8256f3f5ec0d 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -489,9 +489,21 @@ unsigned long next_timer_interrupt(void) | |||
489 | struct list_head *list; | 489 | struct list_head *list; |
490 | struct timer_list *nte; | 490 | struct timer_list *nte; |
491 | unsigned long expires; | 491 | unsigned long expires; |
492 | unsigned long hr_expires = MAX_JIFFY_OFFSET; | ||
493 | ktime_t hr_delta; | ||
492 | tvec_t *varray[4]; | 494 | tvec_t *varray[4]; |
493 | int i, j; | 495 | int i, j; |
494 | 496 | ||
497 | hr_delta = hrtimer_get_next_event(); | ||
498 | if (hr_delta.tv64 != KTIME_MAX) { | ||
499 | struct timespec tsdelta; | ||
500 | tsdelta = ktime_to_timespec(hr_delta); | ||
501 | hr_expires = timespec_to_jiffies(&tsdelta); | ||
502 | if (hr_expires < 3) | ||
503 | return hr_expires + jiffies; | ||
504 | } | ||
505 | hr_expires += jiffies; | ||
506 | |||
495 | base = &__get_cpu_var(tvec_bases); | 507 | base = &__get_cpu_var(tvec_bases); |
496 | spin_lock(&base->t_base.lock); | 508 | spin_lock(&base->t_base.lock); |
497 | expires = base->timer_jiffies + (LONG_MAX >> 1); | 509 | expires = base->timer_jiffies + (LONG_MAX >> 1); |
@@ -542,6 +554,10 @@ found: | |||
542 | } | 554 | } |
543 | } | 555 | } |
544 | spin_unlock(&base->t_base.lock); | 556 | spin_unlock(&base->t_base.lock); |
557 | |||
558 | if (time_before(hr_expires, expires)) | ||
559 | return hr_expires; | ||
560 | |||
545 | return expires; | 561 | return expires; |
546 | } | 562 | } |
547 | #endif | 563 | #endif |