Expand description
§Utility collection for sched_ext schedulers
sched_ext is a Linux kernel feature which enables implementing kernel thread schedulers in BPF and dynamically loading them.
Thie crate is a collection of utilities for sched_ext scheduler implementations which use Rust for userspace component. This enables implementing hot paths in BPF while offloading colder and more complex operations to userspace Rust code which can be significantly more convenient and powerful.
The utilities can be put into two broad categories.
§Build Utilities
BPF being its own CPU architecture and independent runtime environment,
build environment and steps are already rather complex. The need to
interface between two different languages - C and Rust - adds further
complexities. This crate contains struct BpfBuilder
which is to be
used from build.rs
and automates most of the process.
§Utilities for Rust Userspace Component
Utility modules which can be useful for userspace component of sched_ext schedulers.
Modules§
- Running Average Utilities
Macros§
- Must be used together with scx_ops_load!(). See there.
- struct sched_ext_ops can change over time. If compat.bpf.h::SCX_OPS_DEFINE() is used to define ops and scx_ops_load!() and scx_ops_attach!() are used to load and attach it, backward compatibility is automatically maintained where reasonable.
- Takes a reference to C struct user_exit_info and test whether the BPF scheduler has exited. See UserExitInfo.
- Takes a reference to C struct user_exit_info and reads it into UserExitInfo. See UserExitInfo.
- Takes a reference to C struct user_exit_info, reads it and invokes UserExitInfo::report() on it. See UserExitInfo.
- Resize debug dump area according to ops.exit_dump_len. If this macro is not called, debug dump area is not allocated and debug dump won’t be printed out.
- Logs a message at the warn level.
Structs§
- Build helpers for sched_ext schedulers with Rust userspace component
- Generate a topology map from a Topology object, represented as an array of arrays.
- Rust counterpart of C struct user_exit_info.