Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117619
b: refs/heads/master
c: 2e94d1f
h: refs/heads/master
i:
  117617: 8d4be8e
  117615: a10b27f
v: v3
  • Loading branch information
Arjan van de Ven committed Sep 11, 2008
1 parent b0adb61 commit b7f3246
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ae4b748e81b7e366f04f55229d5e372e372c33af
refs/heads/master: 2e94d1f71f7e4404d997e6fb4f1618aa147d76f9
7 changes: 7 additions & 0 deletions trunk/drivers/cpuidle/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/cpu.h>
#include <linux/cpuidle.h>
#include <linux/ktime.h>
#include <linux/hrtimer.h>

#include "cpuidle.h"

Expand Down Expand Up @@ -60,6 +61,12 @@ static void cpuidle_idle_call(void)
return;
}

/*
* run any timers that can be run now, at this point
* before calculating the idle duration etc.
*/
hrtimer_peek_ahead_timers();

/* ask the governor for the next state */
next_state = cpuidle_curr_governor->select(dev);
if (need_resched())
Expand Down
5 changes: 5 additions & 0 deletions trunk/include/linux/hrtimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
extern ktime_t ktime_get(void);
extern ktime_t ktime_get_real(void);


DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
extern void hrtimer_peek_ahead_timers(void);


/* Exported timer functions: */

/* Initialize timers: */
Expand Down
30 changes: 30 additions & 0 deletions trunk/kernel/hrtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,36 @@ void hrtimer_interrupt(struct clock_event_device *dev)
raise_softirq(HRTIMER_SOFTIRQ);
}

/**
* hrtimer_peek_ahead_timers -- run soft-expired timers now
*
* hrtimer_peek_ahead_timers will peek at the timer queue of
* the current cpu and check if there are any timers for which
* the soft expires time has passed. If any such timers exist,
* they are run immediately and then removed from the timer queue.
*
*/
void hrtimer_peek_ahead_timers(void)
{
unsigned long flags;
struct tick_device *td;
struct clock_event_device *dev;

if (hrtimer_hres_active())
return;

local_irq_save(flags);
td = &__get_cpu_var(tick_cpu_device);
if (!td)
goto out;
dev = td->evtdev;
if (!dev)
goto out;
hrtimer_interrupt(dev);
out:
local_irq_restore(flags);
}

static void run_hrtimer_softirq(struct softirq_action *h)
{
run_hrtimer_pending(&__get_cpu_var(hrtimer_bases));
Expand Down

0 comments on commit b7f3246

Please sign in to comment.