Re: [PATCH 6/6] sched_ext: idle: Deprecate scx_bpf_select_cpu_dfl()
From: Andrea Righi
Date: Tue Apr 01 2025 - 02:38:28 EST
On Mon, Mar 31, 2025 at 12:01:22PM -1000, Tejun Heo wrote:
> Hello,
>
> On Fri, Mar 21, 2025 at 11:10:52PM +0100, Andrea Righi wrote:
> > With the introduction of scx_bpf_select_cpu_and(), we can deprecate
> > scx_bpf_select_cpu_dfl(), as it offers only a subset of features and
> > it's also more consistent with other idle-related APIs (returning a
> > negative value when no idle CPU is found).
> >
> > Therefore, mark scx_bpf_select_cpu_dfl() as deprecated (printing a
> > warning when it's used), update all the scheduler examples and
> > kselftests to adopt the new API, and ensure backward (source and binary)
> > compatibility by providing the necessary macros and hooks.
> >
> > Support for scx_bpf_select_cpu_dfl() can be maintained until v6.17.
>
> Do we need to deprecate it?
>
> ...
> > @@ -43,10 +39,13 @@ s32 BPF_STRUCT_OPS(select_cpu_dfl_nodispatch_select_cpu, struct task_struct *p,
> > return -ESRCH;
> > }
> >
> > - cpu = scx_bpf_select_cpu_dfl(p, prev_cpu, wake_flags,
> > - &tctx->force_local);
> > + cpu = scx_bpf_select_cpu_and(p, prev_cpu, wake_flags, p->cpus_ptr, 0);
> > + if (cpu >= 0) {
> > + tctx->force_local = true;
> > + return cpu;
> > + }
> >
> > - return cpu;
> > + return prev_cpu;
> > }
>
> scx_bpf_select_cpu_dfl() is simpler for simple cases. I don't see a pressing
> need to convert everybody to _and().
Yeah, I don't have strong opinions on this, I included this patch mostly to
show that we can get rid of a kfunc if we want, but we don't really have to
and it's probably less work to just keep it. I'll drop this patch in the
next version.
Thanks for the review!
-Andrea