Merge "sched: core: Exclude isolated cpus in sched_getaffinity cpumask"

This commit is contained in:
Linux Build Service Account 2018-01-09 15:40:38 -08:00 committed by Gerrit - the friendly Code Review server
commit 20ab01289c

View file

@ -4914,6 +4914,15 @@ long sched_getaffinity(pid_t pid, struct cpumask *mask)
raw_spin_lock_irqsave(&p->pi_lock, flags); raw_spin_lock_irqsave(&p->pi_lock, flags);
cpumask_and(mask, &p->cpus_allowed, cpu_active_mask); cpumask_and(mask, &p->cpus_allowed, cpu_active_mask);
/*
* The userspace tasks are forbidden to run on
* isolated CPUs. So exclude isolated CPUs from
* the getaffinity.
*/
if (!(p->flags & PF_KTHREAD))
cpumask_andnot(mask, mask, cpu_isolated_mask);
raw_spin_unlock_irqrestore(&p->pi_lock, flags); raw_spin_unlock_irqrestore(&p->pi_lock, flags);
out_unlock: out_unlock: