Skip to content

Commit

Permalink
sched/core: Check cpus_mask, not cpus_ptr in __set_cpus_allowed_ptr()…
Browse files Browse the repository at this point in the history
…, 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 <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
  • Loading branch information
crwood-rh authored and suryasaimadhu committed Jun 28, 2020
1 parent 4f311af commit fd844ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ static int __set_cpus_allowed_ptr(struct task_struct *p,
goto out;
}

if (cpumask_equal(p->cpus_ptr, new_mask))
if (cpumask_equal(&p->cpus_mask, new_mask))
goto out;

/*
Expand Down

0 comments on commit fd844ba

Please sign in to comment.