Re: [PATCHSET sched_ext/for-6.15] sched_ext: Enhance built-in idle selection with preferred CPUs

Andrea Righi
2025-03-06T18:54:45Z

Hi Tejun,

On Thu, Mar 06, 2025 at 08:34:15AM -1000, Tejun Heo wrote:
> Hello,
>
> On Thu, Mar 06, 2025 at 07:18:03PM +0100, Andrea Righi wrote:
> > To implement this, introduce a new helper kfunc scx_bpf_select_cpu_pref()
> > that allows to specify a cpumask of preferred CPUs:
> >
> > s32 scx_bpf_select_cpu_pref(struct task_struct *p,
> > const struct cpumask *preferred_cpus,
> > s32 prev_cpu, u64 wake_flags, u64 flags);
> >
> > Moreover, introduce the new idle flag %SCX_PICK_IDLE_IN_PREF that can be
> > used to enforce selection strictly within the preferred domain.
>
> Would something like scx_bpf_select_cpu_and() work which is only allowed
> pick in the intersection (ie. always SCX_PICK_IDLE_IN_PREF). I'm not sure
> how much more beneficial a built-in two-level mechanism is especially given
> that it wouldn't be too uncommon to need multi-level pick - e.g. within l3
> then within numa node and so on.

Just to make sure I understand, you mean provide two separate kfuncs:
scx_bpf_select_cpu_and() and scx_bpf_select_cpu_pref(), instead of
introducing the flag?

Thanks,
-Andrea