sched: Fix runnable condition for stoptask

Heiko reported that the TASK_RUNNING check is not sufficient for
CONFIG_PREEMPT=y since we can get preempted with !TASK_RUNNING.

He suggested adding a ->se.on_rq test to the existing TASK_RUNNING
one, however TASK_RUNNING will always have ->se.on_rq, so we might as
well reduce that to a single test.

[ stop tasks should never get preempted, but its good to handle
this case correctly should this ever happen ]

Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by Peter Zijlstra and committed by Ingo Molnar 2d467090 aae6d3dd

+1 -1
+1 -1
kernel/sched_stoptask.c
··· 26 { 27 struct task_struct *stop = rq->stop; 28 29 - if (stop && stop->state == TASK_RUNNING) 30 return stop; 31 32 return NULL;
··· 26 { 27 struct task_struct *stop = rq->stop; 28 29 + if (stop && stop->se.on_rq) 30 return stop; 31 32 return NULL;