idle: add a check for need_resched() after rcu_idle_enter

rcu_idle_enter() can wake up ksoftirqd to finish RCU callbacks
before entering idle. Hence add a check for need_resched() after
rcu_idle_enter(). The CPU enters idle without this check and
tasks queued on this CPU are starved until CPU exits idle.

The cpuidle subsystem has checks for need_resched() before
entering CPU idle, but these checks does not come into the
picture if cpuidle is not enabled or becomes active during
boot.

Change-Id: I747e49acb41f201bdc9a7c12d81f366e76bbdbb3
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
This commit is contained in:
Pavankumar Kondeti 2016-09-23 06:50:12 +05:30 committed by Gerrit - the friendly Code Review server
parent 13687eeaa5
commit 632b40616e
1 changed files with 4 additions and 1 deletions

View File

@ -117,7 +117,10 @@ static void cpu_idle_loop(void)
if (!current_clr_polling_and_test()) {
stop_critical_timings();
rcu_idle_enter();
arch_cpu_idle();
if (!need_resched())
arch_cpu_idle();
else
local_irq_enable();
WARN_ON_ONCE(irqs_disabled());
rcu_idle_exit();
start_critical_timings();