SCX eBPF macro scx_bpf_dsq_move_to_local
The scx_bpf_dsq_move_to_local macro handles the renaming of scx_bpf_consume to scx_bpf_dsq_move_to_local gracefully.
It also handles the introduction of scx_bpf_dsq_move_to_local___v2, using it when available, falling back to v1 when not.
Definition
#define scx_bpf_dsq_move_to_local(dsq_id, enq_flags) \
(bpf_ksym_exists(scx_bpf_dsq_move_to_local___v2) ? \
scx_bpf_dsq_move_to_local___v2((dsq_id), (enq_flags)) : \
(bpf_ksym_exists(scx_bpf_dsq_move_to_local___v1) ? \
scx_bpf_dsq_move_to_local___v1((dsq_id)) : \
scx_bpf_consume___old((dsq_id))))
Usage
This macro has the same name as the scx_bpf_dsq_move_to_local kfunc, which will cause the pre-processor to emit this macro instead of just the kfunc. It checks at runtime if the kernel has the scx_bpf_dsq_move_to_local kfunc, and if it does, it calls it. If it doesn't, it calls the scx_bpf_consume___compat kfunc instead.
These two kfuncs are functionally equivalent, but a rename happened since the name dispatch was overloaded and confusing.
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome