Re: [RFC PATCH 1/3] sched: Introduce new interface for scheduler soft affinity

From: Peter Zijlstra
Date: Tue Jul 02 2019 - 12:23:26 EST


On Wed, Jun 26, 2019 at 03:47:16PM -0700, subhra mazumdar wrote:
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 1183741..b863fa8 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -652,6 +652,8 @@ struct task_struct {
> unsigned int policy;
> int nr_cpus_allowed;
> cpumask_t cpus_allowed;

You're patching dead code, that no longer exists.

> + cpumask_t cpus_preferred;
> + bool affinity_unequal;

Urgh, no. cpumask_t is an abomination and having one of them is already
unfortunate, having two is really not sane, esp. since for 99% of the
tasks they'll be exactly the same.

Why not add cpus_ptr_soft or something like that, and have it point at
cpus_mask by default, and when it needs to not be the same, allocate a
cpumask for it. That also gets rid of that unequal thing.