Re: [PATCH v3 2/3] sched/core: Don't mix isolcpus and housekeeping CPUs

From: Peter Zijlstra
Date: Fri Oct 26 2018 - 04:49:52 EST


On Fri, Oct 26, 2018 at 12:12:22AM +0530, Srikar Dronamraju wrote:
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 3064e0f..37e62b8 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1003,7 +1003,19 @@ static int migration_cpu_stop(void *data)
> */
> void set_cpus_allowed_common(struct task_struct *p, const struct cpumask *new_mask)
> {
> - cpumask_copy(&p->cpus_allowed, new_mask);
> + const struct cpumask *hk_mask = housekeeping_cpumask(HK_FLAG_DOMAIN);
> +
> + /*
> + * If the cpumask provided has CPUs that are part of isolated and
> + * housekeeping_cpumask, then restrict it to just the CPUs that
> + * are part of the housekeeping_cpumask.
> + */
> + if (!cpumask_subset(new_mask, hk_mask) &&
> + cpumask_intersects(new_mask, hk_mask))
> + cpumask_and(&p->cpus_allowed, new_mask, hk_mask);
> + else
> + cpumask_copy(&p->cpus_allowed, new_mask);
> +
> p->nr_cpus_allowed = cpumask_weight(new_mask);

NAK, I already explained that.