Re: [PATCH sched_ext/for-7.1] tools/sched_ext: Add __COMPAT wrapper for scx_bpf_sub_dispatch()

Tejun Heo
2026-03-22T20:12:30Z

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