sched/idle: Clear polling before descheduling the idle thread
authorAndy Lutomirski <luto@amacapital.net>
Wed, 4 Jun 2014 17:31:16 +0000 (10:31 -0700)
committerIngo Molnar <mingo@kernel.org>
Thu, 5 Jun 2014 10:09:51 +0000 (12:09 +0200)
commit82c65d60d64401aedc1006d6572469bbfdf148de
treeffa4aa0ece7bcff7bf5426b882c90e80172ff15b
parentdfc68f29ae67f2a6e799b44e6a4eb3417dffbfcd
sched/idle: Clear polling before descheduling the idle thread

Currently, the only real guarantee provided by the polling bit is
that, if you hold rq->lock and the polling bit is set, then you can
set need_resched to force a reschedule.

The only reason the lock is needed is that the idle thread might not
be running at all when setting its need_resched bit, and rq->lock
keeps it pinned.

This is easy to fix: just clear the polling bit before scheduling.
Now the idle thread's polling bit is only ever set when
rq->curr == rq->idle.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: nicolas.pitre@linaro.org
Cc: daniel.lezcano@linaro.org
Cc: umgwanakikbuti@gmail.com
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/b2059fcb4c613d520cb503b6fad6e47033c7c203.1401902905.git.luto@amacapital.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/idle.c