Commit 077614ee authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

sched: Fix broken assertion

There's a preemption race in the set_task_cpu() debug check in
that when we get preempted after setting task->state we'd still
be on the rq proper, but fail the test.

Check for preempted tasks, since those are always on the RQ.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20091217121830.137155561@chello.nl>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent e1781538
...@@ -2041,7 +2041,8 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu) ...@@ -2041,7 +2041,8 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
* We should never call set_task_cpu() on a blocked task, * We should never call set_task_cpu() on a blocked task,
* ttwu() will sort out the placement. * ttwu() will sort out the placement.
*/ */
WARN_ON_ONCE(p->state != TASK_RUNNING && p->state != TASK_WAKING); WARN_ON_ONCE(p->state != TASK_RUNNING && p->state != TASK_WAKING &&
!(task_thread_info(p)->preempt_count & PREEMPT_ACTIVE));
#endif #endif
trace_sched_migrate_task(p, new_cpu); trace_sched_migrate_task(p, new_cpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment