Return EINVAL, if the user has passed a mix of isolcpus and housekeeping CPUs in cpumask to sched_setaffinity(). This will ensure that users are notified so that they can take corrective actions to ensure consistent behaviour. This might cause a change in sched_setaffinity behaviour when isolcpus is set.
Suggested-by: Mel Gorman <[email protected]> Signed-off-by: Srikar Dronamraju <[email protected]> --- kernel/sched/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 37e62b8..3842471 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4798,9 +4798,12 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask) * housekeeping_cpumask */ if (!cpumask_subset(new_mask, hk_mask) && - cpumask_intersects(new_mask, hk_mask)) + cpumask_intersects(new_mask, hk_mask)) { pr_warn("pid %d: Mix of isolcpus and non-isolcpus provided\n", p->pid); + retval = -EINVAL; + goto out_free_new_mask; + } /* * Since bandwidth control happens on root_domain basis, -- 1.8.3.1

