Skip to content

Commit

Permalink
sched: Fix runnable condition for stoptask
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Nov 10, 2010
1 parent aae6d3d commit 2d46709
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sched_stoptask.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static struct task_struct *pick_next_task_stop(struct rq *rq)
{
struct task_struct *stop = rq->stop;

if (stop && stop->state == TASK_RUNNING)
if (stop && stop->se.on_rq)
return stop;

return NULL;
Expand Down

0 comments on commit 2d46709

Please sign in to comment.