Expand description
ยงSCX Arena library setup utilities
Crate for setting up the BPF arena library for sched-ext schedulers.
Modulesยง
Structsยง
- Arena
Lib - Live BPF arena library state. Returned by setup() and must be kept alive for as long as the scheduler instance uses the arena: dropping it stops and joins the libraryโs background threads.
- Daemon ๐
- One background thread and the eventfd that stops it. Dropping writes the eventfd and joins the thread.
Constantsยง
- BPF_
STDERR ๐ - BPF_
STDOUT ๐ - BPF_
STREAMS ๐ - CACHELINE_
SIZE - MEMBARRIER_
CMD_ ๐GLOBAL - STREAM_
POLL_ ๐INTERVAL - URCU_
DOORBELL ๐ - URCU_
MIN_ ๐INTERVAL
Functionsยง
- prog_
fd_ ๐clone - Duplicate @progโs fd, None for programs that were not loaded and thus have no fd, prog.as_fd() on those would construct a BorrowedFd from an invalid fd. Errors only when a loaded programโs fd cannot be duplicated.
- stop_
eventfd ๐ - Create the eventfd a Daemon is stopped through.
- stream_
extract_ ๐lines - Split the complete lines out of @carry, keeping a trailing partial for the next read. Stream elements are concatenated without separators and reads split lines arbitrarily, so prefixes may only be matched on complete lines. @new_data says whether this poll read anything: a partial with no continuation after a full poll interval is flushed as a line of its own.
- stream_
is_ ๐fatal - The kernel prefixes the errors it reports on a programโs BPF stderr stream with โERROR: โ.
- stream_
read ๐ - stream_
watcher_ ๐spawn - Forward the BPF stdout/stderr streams of every program in the object to the schedulerโs stdout and stderr respectively, and abort when the kernel reports an error on a stderr stream. Nothing reads these streams otherwise, so messages would be silently dropped. Lines prefixed โIGN: โ are dropped instead of forwarded, for prints with side effects that nobody needs to see, the arena association print in scx_arena_subprog_init() for example. Called from ArenaLib::setup(), the watcher is owned by the returned ArenaLib.
- urcu_
daemon ๐ - urcu_
run_ ๐prog - Userspace half of the scx_urcu machinery, see the BPF side in lib/sdt_alloc.bpf.c. ArenaLib::setup() spawns the daemon when the object carries the scx_urcu doorbell. The returned ArenaLib owns it and stops and joins it on drop, so nothing else is visible to the scheduler: its whole runtime surface is calling the scx_*_free_rcu() variants from its free path hooks.
- urcu_
spawn ๐ - Spawn the urcu reclaim daemon if @obj carries the scx_urcu doorbell and driver programs. Called from ArenaLib::setup(), the daemon is owned by the returned ArenaLib.