Re: [PATCH 6/6] sched_ext: idle: Deprecate scx_bpf_select_cpu_dfl()
From: Tejun Heo
Date: Mon Mar 31 2025 - 18:01:29 EST
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().
Thanks.
--
tejun