From 248d7100ffa9197cd7de996a31cb2edc637ca05f Mon Sep 17 00:00:00 2001 From: Vikram Mulukutla Date: Fri, 17 Oct 2014 15:40:42 -0700 Subject: idle: exit the cpu_idle_poll loop if cpu_idle_force_poll is cleared cpu_idle_poll_ctrl allows the enabling/disabling of the idle polling mode; this mode allows a CPU to spin waiting for a new task to be scheduled rather than having to execute the arch specific idle code. However, the loop that checks for a new task does not look at the flag that enables idle polling mode. So, the CPU may continue to spin even though the aforementioned flag has been cleared. Since the CPU is already in idle, it may be a while before a task is scheduled, precluding potential power savings. Modify the while loop conditional in question to also check if the cpu_idle_force_poll flag is set. Change-Id: Ia2e83af97890dc399b86e090459a41d31ce28b6c Signed-off-by: Vikram Mulukutla --- kernel/cpu/idle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/cpu/idle.c b/kernel/cpu/idle.c index 1b7cf4190..2e45a5852 100644 --- a/kernel/cpu/idle.c +++ b/kernel/cpu/idle.c @@ -50,7 +50,7 @@ static inline int cpu_idle_poll(void) rcu_idle_enter(); trace_cpu_idle_rcuidle(0, smp_processor_id()); local_irq_enable(); - while (!tif_need_resched()) + while (!tif_need_resched() && cpu_idle_force_poll) cpu_relax(); trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id()); rcu_idle_exit(); -- cgit v1.2.3