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.
This 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.
Re-exports§
pub use user_exit_info::SCX_ECODE_ACT_RESTART;
pub use user_exit_info::SCX_ECODE_RSN_HOTPLUG;
pub use topology::NR_CPU_IDS;
pub use topology::NR_CPUS_POSSIBLE;
pub use misc::monitor_stats;
pub use misc::normalize_load_metric;
pub use misc::set_rlimit_infinity;
pub use enums::scx_enums;
Modules§
- autopower
- bindings 🔒
- bpf_
builder 🔒 - build_
id - builder 🔒
- clang_
info 🔒 - compat
- cpumask 🔒
- SCX Cpumask
- energy_
model 🔒 - SCX Energy Model
- enums
- infeasible 🔒
- SCX Load Calculator
- libbpf_
logger 🔒 - mangoapp
- misc
- netdev 🔒
- perf
- pm
- ravg
- Running Average Utilities
- topology 🔒
- SCX Topology
- user_
exit_ 🔒info
Macros§
- import_
enums - info
- Logs a message at the info level.
- paste
- scx_
ops_ attach - Must be used together with scx_ops_load!(). See there.
- scx_
ops_ load - struct sched_ext_ops can change over time. If compat.bpf.h::SCX_OPS_DEFINE() is used to define ops, and scx_ops_open!(), scx_ops_load!(), and scx_ops_attach!() are used to open, load and attach it, backward compatibility is automatically maintained where reasonable.
- scx_
ops_ open - struct sched_ext_ops can change over time. If compat.bpf.h::SCX_OPS_DEFINE() is used to define ops, and scx_ops_open!(), scx_ops_load!(), and scx_ops_attach!() are used to open, load and attach it, backward compatibility is automatically maintained where reasonable.
- uei_
exited - Takes a reference to C struct user_exit_info and test whether the BPF scheduler has exited. See UserExitInfo.
- uei_
read - Takes a reference to C struct user_exit_info and reads it into UserExitInfo. See UserExitInfo.
- uei_
report - Takes a reference to C struct user_exit_info, reads, invokes UserExitInfo::report() on and then returns Ok(uei). See UserExitInfo.
- uei_
set_ size - 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.
- unwrap_
or_ break - warn
- Logs a message at the warn level.
Structs§
- BpfBuilder
- Build helpers for sched_ext schedulers with Rust userspace component
- Builder
- Core
- Cpu
- Cpumask
- Energy
Model - Llc
- Load
Aggregator - Load
Ledger - NR_
CPUS_ POSSIBLE - The number of possible CPUs that may be active on the system. Note that this value is separate from the number of possible CPU IDs in the system, as there may be gaps in what CPUs are allowed to be onlined. For example, some BIOS implementations may report spans of disabled CPUs that may not be onlined, whose IDs are lower than the IDs of other CPUs that may be onlined.
- NR_
CPU_ IDS - The maximum possible number of CPU IDs in the system. As mentioned above, this is different than the number of possible CPUs on the system (though very seldom is). This number may differ from the number of possible CPUs on the system when e.g. there are fully disabled CPUs in the middle of the range of possible CPUs (i.e. CPUs that may not be onlined).
- NetDev
- Node
- Perf
Domain - Perf
State - SCX_
ECODE_ ACT_ RESTART - SCX_
ECODE_ RSN_ HOTPLUG - Topology
- UeiDump
Ptr - User
Exit Info - Rust counterpart of C struct user_exit_info.