aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVikram Mulukutla <markivx@codeaurora.org>2014-10-17 15:40:42 -0700
committerMister Oyster <oysterized@gmail.com>2017-04-13 12:32:11 +0200
commit248d7100ffa9197cd7de996a31cb2edc637ca05f (patch)
tree1a4f9a33f7e64f1c8f47cc948c64974e713d8cbd
parenta1fed10f708642227856cf6bb8ffcb6cdf16b656 (diff)
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 <markivx@codeaurora.org>
-rw-r--r--kernel/cpu/idle.c2
1 files changed, 1 insertions, 1 deletions
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();