SCX eBPF macro scx_bpf_dsq_insert_vtime
The scx_bpf_dsq_insert_vtime macro handles the renaming of scx_bpf_dispatch_vtime to scx_bpf_dsq_insert_vtime gracefully.
Definition
#define scx_bpf_dsq_insert_vtime(p, dsq_id, slice, vtime, enq_flags) \
(bpf_ksym_exists(scx_bpf_dsq_insert_vtime) ? \
scx_bpf_dsq_insert_vtime((p), (dsq_id), (slice), (vtime), (enq_flags)) : \
scx_bpf_dispatch_vtime___compat((p), (dsq_id), (slice), (vtime), (enq_flags)))
Usage
This macro has the same name as the scx_bpf_dsq_insert_vtime 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_insert_vtime kfunc, and if it does, it calls it. If it doesn't, it calls the scx_bpf_dispatch_vtime___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