sched: Fix broken assertion
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Thu, 17 Dec 2009 12:16:31 +0000 (13:16 +0100)
committerIngo Molnar <mingo@elte.hu>
Thu, 17 Dec 2009 12:22:46 +0000 (13:22 +0100)
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: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20091217121830.137155561@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/sched.c

index 7be88a7be0471f8f7c90c6f8e5e795982e6d7aae..720df108a2d6183cbfc240a6c2b6c8c5b1b9c0a8 100644 (file)
@@ -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,
         * 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
 
        trace_sched_migrate_task(p, new_cpu);