mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[PATCH] fix next_timer_interrupt() for hrtimer
Also from Thomas Gleixner <tglx@linutronix.de>
Function next_timer_interrupt() got broken with a recent patch
6ba1b91213
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>
This commit is contained in:
parent
f7c09bd972
commit
69239749e1
4 changed files with 61 additions and 4 deletions
|
@ -489,9 +489,21 @@ unsigned long next_timer_interrupt(void)
|
|||
struct list_head *list;
|
||||
struct timer_list *nte;
|
||||
unsigned long expires;
|
||||
unsigned long hr_expires = MAX_JIFFY_OFFSET;
|
||||
ktime_t hr_delta;
|
||||
tvec_t *varray[4];
|
||||
int i, j;
|
||||
|
||||
hr_delta = hrtimer_get_next_event();
|
||||
if (hr_delta.tv64 != KTIME_MAX) {
|
||||
struct timespec tsdelta;
|
||||
tsdelta = ktime_to_timespec(hr_delta);
|
||||
hr_expires = timespec_to_jiffies(&tsdelta);
|
||||
if (hr_expires < 3)
|
||||
return hr_expires + jiffies;
|
||||
}
|
||||
hr_expires += jiffies;
|
||||
|
||||
base = &__get_cpu_var(tvec_bases);
|
||||
spin_lock(&base->t_base.lock);
|
||||
expires = base->timer_jiffies + (LONG_MAX >> 1);
|
||||
|
@ -542,6 +554,10 @@ found:
|
|||
}
|
||||
}
|
||||
spin_unlock(&base->t_base.lock);
|
||||
|
||||
if (time_before(hr_expires, expires))
|
||||
return hr_expires;
|
||||
|
||||
return expires;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue