I am not sure...
Suppose that p was TASK_INTERRUPTIBLE and p->on_rq == 1 before, when
set_cpus_allowed_ptr() was called. To simplify, suppose that
the caller is preempted right after it drops p->pi_lock and before
it does stop_one_cpu(migration_cpu_stop).
After that p can complete chedule() and deactivate itself.
Now, try_to_wake_up() can set TASK_WAKING, choose another CPU,
and do ttwu_queue_remote().
Finally, the caller of set_cpus_allowed_ptr() resumes and
schedules migration_cpu_stop.
It is very possible I missed something, but what is the new
locking rules for set_task_cpu() anyway? I mean, which rq->lock
it needs?
Oleg.
--