sched/core: Check cpus_mask, not cpus_ptr in __set_cpus_allowed_ptr(), to fix mask corruption

This function is concerned with the long-term CPU mask, not the
transitory mask the task might have while migrate disabled.  Before
this patch, if a task was migrate-disabled at the time
__set_cpus_allowed_ptr() was called, and the new mask happened to be
equal to the CPU that the task was running on, then the mask update
would be lost.

Signed-off-by: Scott Wood <>
Signed-off-by: Sebastian Andrzej Siewior <>
Signed-off-by: Peter Zijlstra (Intel) <>
Signed-off-by: Ingo Molnar <>
1 file changed