SCX
The kernel concludes a number of example sched_ext BPF schedulers. These examples make use of some common header files that aid in writing schedulers. These are located in tools/sched_ext/include/scx. We document macros inside of these to make following examples easier and because kfuncs and the sched_ext_ops reference them.
Note
These in-tree headers are based on files developed in an out of tree sched-ext/scx project, which moves faster than the kernel. If you are looking for a library to use in your own projects, you may want to look at the out of tree project.
common.bpf.h
This header file provides a number of macros that might be useful when writing schedulers. It also contains forward declarations for most kfuncs that might be of use.
Definitions in this file are:
BPF_FOR_EACH_ITERscx_bpf_bstr_preamblescx_bpf_exitscx_bpf_errorscx_bpf_dumpBPF_STRUCT_OPSBPF_STRUCT_OPS_SLEEPABLERESIZABLE_ARRAYARRAY_ELEM_PTRMEMBER_VPTR__containsprivatebpf_obj_newbpf_obj_dropbpf_rbtree_addbpf_refcount_acquirecast_masklikelyunlikelyREAD_ONCEWRITE_ONCElog2_u32log2_u64
compat.bpf.h
This header file provides compatibility wrappers that pick the right implementation based on the kernel version, dealing with the fact that the sched_ext implementation is still in flux.
Definitions in this file are: