sched: Migrate waking tasks
Current code can fail to migrate a waking task (silently) when TTWU_QUEUE is
When a task is waking, it is pending on the wake_list of the rq, but it is not
queued (task->on_rq == 0). In this case, set_cpus_allowed_ptr() and
__migrate_task() will not migrate it because its invisible to them.
This behavior is incorrect, because the task has been already woken, it will be
running on the wrong CPU without correct placement until the next wake-up or
update for cpus_allowed.
To fix this problem, we need to finish the wakeup (so they appear on
the runqueue) before we migrate them.
Reported-by: Sasha Levin <firstname.lastname@example.org>
Reported-by: Jason J. Herne <email@example.com>
Tested-by: Jason J. Herne <firstname.lastname@example.org>
Signed-off-by: Lai Jiangshan <email@example.com>
Signed-off-by: Peter Zijlstra (Intel) <firstname.lastname@example.org>
Cc: Linus Torvalds <email@example.com>
Signed-off-by: Ingo Molnar <firstname.lastname@example.org>
1 file changed