diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2008-09-10 19:06:00 -0400 |
---|---|---|
committer | Arjan van de Ven <arjan@linux.intel.com> | 2008-09-11 10:17:49 -0400 |
commit | 2e94d1f71f7e4404d997e6fb4f1618aa147d76f9 (patch) | |
tree | 73958a61dffff311cdcdc8edcb7e6a4953150601 /kernel/hrtimer.c | |
parent | ae4b748e81b7e366f04f55229d5e372e372c33af (diff) |
hrtimer: peek at the timer queue just before going idle
As part of going idle, we already look at the time of the next timer event to determine
which C-state to select etc.
This patch adds functionality that causes the timers that are past their
soft expire time, to fire at this time, before we calculate the next wakeup
time. This functionality will thus avoid wakeups by running timers before
going idle rather than specially waking up for it.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Diffstat (limited to 'kernel/hrtimer.c')
-rw-r--r-- | kernel/hrtimer.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 9a4c90185566..eb2cf984959f 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -1381,6 +1381,36 @@ void hrtimer_interrupt(struct clock_event_device *dev) | |||
1381 | raise_softirq(HRTIMER_SOFTIRQ); | 1381 | raise_softirq(HRTIMER_SOFTIRQ); |
1382 | } | 1382 | } |
1383 | 1383 | ||
1384 | /** | ||
1385 | * hrtimer_peek_ahead_timers -- run soft-expired timers now | ||
1386 | * | ||
1387 | * hrtimer_peek_ahead_timers will peek at the timer queue of | ||
1388 | * the current cpu and check if there are any timers for which | ||
1389 | * the soft expires time has passed. If any such timers exist, | ||
1390 | * they are run immediately and then removed from the timer queue. | ||
1391 | * | ||
1392 | */ | ||
1393 | void hrtimer_peek_ahead_timers(void) | ||
1394 | { | ||
1395 | unsigned long flags; | ||
1396 | struct tick_device *td; | ||
1397 | struct clock_event_device *dev; | ||
1398 | |||
1399 | if (hrtimer_hres_active()) | ||
1400 | return; | ||
1401 | |||
1402 | local_irq_save(flags); | ||
1403 | td = &__get_cpu_var(tick_cpu_device); | ||
1404 | if (!td) | ||
1405 | goto out; | ||
1406 | dev = td->evtdev; | ||
1407 | if (!dev) | ||
1408 | goto out; | ||
1409 | hrtimer_interrupt(dev); | ||
1410 | out: | ||
1411 | local_irq_restore(flags); | ||
1412 | } | ||
1413 | |||
1384 | static void run_hrtimer_softirq(struct softirq_action *h) | 1414 | static void run_hrtimer_softirq(struct softirq_action *h) |
1385 | { | 1415 | { |
1386 | run_hrtimer_pending(&__get_cpu_var(hrtimer_bases)); | 1416 | run_hrtimer_pending(&__get_cpu_var(hrtimer_bases)); |