The p->pi_lock serialization of p->sched_class allows us to callscheduling class methods without holding the rq->lock, and theserialization of p->cpus_allowed allows us to do the load-balancingbits without races.

- /*- * We migrated the task without holding either rq->lock, however- * since the task is not on the task list itself, nobody else- * will try and migrate the task, hence the rq should match the- * cpu we just moved it to.- */- WARN_ON(task_cpu(p) != cpu);- WARN_ON(p->state != TASK_WAKING);+#ifdef CONFIG_SMP+ if (cpu != task_cpu(p))+ set_task_cpu(p, cpu);