Re: [PATCHSET v7] sched_ext: Enhance built-in idle selection with allowed CPUs

From: Tejun Heo
Date: Mon Apr 07 2025 - 13:16:33 EST


On Sat, Apr 05, 2025 at 03:39:20PM +0200, Andrea Righi wrote:
> Many scx schedulers implement their own hard or soft-affinity rules to
> support topology characteristics, such as heterogeneous architectures
> (e.g., big.LITTLE, P-cores/E-cores), or to categorize tasks based on
> specific properties (e.g., running certain tasks only in a subset of CPUs).
>
> Currently, there is no mechanism that allows to use the built-in idle CPU
> selection policy to an arbitrary subset of CPUs. As a result, schedulers
> often implement their own idle CPU selection policies, which are typically
> similar to one another, leading to a lot of code duplication.
>
> To address this, extend the built-in idle CPU selection policy introducing
> the concept of allowed CPUs.
>
> With this concept, BPF schedulers can apply the built-in idle CPU selection
> policy to a subset of allowed CPUs, allowing them to implement their own
> hard/soft-affinity rules while still using the topology optimizations of
> the built-in policy, preventing code duplication across different
> schedulers.
>
> To implement this introduce a new helper kfunc scx_bpf_select_cpu_and()
> that accepts a cpumask of allowed CPUs:
>
> s32 scx_bpf_select_cpu_and(struct task_struct *p, s32 prev_cpu,
> u64 wake_flags,

Applied to sched_ext/for-6.16.

Thanks!

--
tejun