Re: [PATCH 3/6] sched_ext: idle: Introduce the concept of allowed CPUs

Tejun Heo
2025-03-10T16:07:23Z

Hello,

On Sun, Mar 09, 2025 at 04:39:40PM +0100, Andrea Righi wrote:
> > Would just using a pre-allocated cpumask to do pre-and on @cpus_allowed
> > work? This won't only be used for topology support (e.g. soft partitioning
> > in scx_layered and scx_mitosis may want to use multi-topology-unit spanning
> > subsets) and I'm not sure assuming and optimizing for that is a good idea
> > for generic API.
>
> We can pre-allocate two additional (per-cpu) cpumasks to do:
> - cpumask_and(numa_cpus, numa_span(cpu), cpus_allowed)
> - cpumask_and(llc_cpus, llc_span(cpu), cpus_allowed)
>
> And update/use them only when it's needed. In this way the API would be
> generic without making any implicit assumption about @cpus_allowed.

I'm not quite following why two masks would be necessary. The user is
providing two masks and and'ing those two masks result in a single
cpus_allowed mask which can then be passed down to the existing pick
functions, no?

Thanks.

--
tejun