Re: [PATCH sched_ext/for-7.1] tools/sched_ext: Add __COMPAT wrapper for scx_bpf_sub_dispatch()
From: Tejun Heo
Date: Sun Mar 22 2026 - 16:12:38 EST
Hello,
Let's not use the __COMPAT prefix. I'd like to move toward making compat
wrappers transparent so that schedulers don't need code changes for
compatibility as much as reasonably possible.
Instead, declare the kfunc with a ___compat suffix and provide a static
inline wrapper with the original name, like scx_bpf_dsq_insert() does:
bool scx_bpf_sub_dispatch___compat(u64 cgroup_id) __ksym __weak;
static inline bool scx_bpf_sub_dispatch(u64 cgroup_id)
{
if (bpf_ksym_exists(scx_bpf_sub_dispatch___compat))
return scx_bpf_sub_dispatch___compat(cgroup_id);
return false;
}
See tools/sched_ext/include/scx/compat.bpf.h around line 326-342 for the
full pattern.
This way schedulers just call scx_bpf_sub_dispatch() directly and the
compat layer handles everything. The no-op fallback (returning false) is
fine here since without sub-sched support the dispatch path can't do
anything useful anyway.
Thanks.
--
tejun