diff options
author | Preeti U Murthy <preeti@linux.vnet.ibm.com> | 2015-01-21 05:57:25 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-01-30 13:38:52 -0500 |
commit | ff6f2d29bd31cdfa1ac494a8b26d2af8ba887d59 (patch) | |
tree | 9c40af46ead9789f5c0a6c55ea2f30a18d08d756 /kernel/sched | |
parent | a18b5d01819235629289212ad428a5ee2b40f0d9 (diff) |
sched/idle: Add missing checks to the exit condition of cpu_idle_poll()
cpu_idle_poll() is entered into when either the cpu_idle_force_poll is set or
tick_check_broadcast_expired() returns true. The exit condition from
cpu_idle_poll() is tif_need_resched().
However this does not take into account scenarios where cpu_idle_force_poll
changes or tick_check_broadcast_expired() returns false, without setting
the resched flag. So a cpu will be caught in cpu_idle_poll() needlessly,
thereby wasting power. Add an explicit check on cpu_idle_force_poll and
tick_check_broadcast_expired() to the exit condition of cpu_idle_poll()
to avoid this.
Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20150121105655.15279.59626.stgit@preeti.in.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/idle.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index c47fce75e666..aaf1c1d5cf5d 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c | |||
@@ -47,7 +47,8 @@ static inline int cpu_idle_poll(void) | |||
47 | rcu_idle_enter(); | 47 | rcu_idle_enter(); |
48 | trace_cpu_idle_rcuidle(0, smp_processor_id()); | 48 | trace_cpu_idle_rcuidle(0, smp_processor_id()); |
49 | local_irq_enable(); | 49 | local_irq_enable(); |
50 | while (!tif_need_resched()) | 50 | while (!tif_need_resched() && |
51 | (cpu_idle_force_poll || tick_check_broadcast_expired())) | ||
51 | cpu_relax(); | 52 | cpu_relax(); |
52 | trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id()); | 53 | trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id()); |
53 | rcu_idle_exit(); | 54 | rcu_idle_exit(); |