Skip to main content

Crate scx_arena

Crate scx_arena 

Source
Expand description

ยงSCX Arena library setup utilities

Crate for setting up the BPF arena library for sched-ext schedulers.

Modulesยง

arenalib ๐Ÿ”’
bpf_skel ๐Ÿ”’

Structsยง

ArenaLib
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.