The scx repository is organized as a Cargo workspace containing multiple schedulers, shared libraries, and tools.
Schedulers are implemented as individual Rust crates under scheds/rust/*.
This document explains how to build the entire project as well as individual schedulers and tools.
The project defines several Cargo build profiles in the top-level Cargo.toml:
-
release Thin LTO enabled (default for production).
-
release-tiny Stripped, thin LTO, optimized for small binary size.
-
release-fast Optimized for compilation speed and native CPU optimizations, no LTO.
You can select a profile using the --profile option, for example:
cargo build --profile=release-tinyTo build all crates (schedulers, libraries, and tools):
-
Debug build (default):
cargo build
-
Optimized release build:
cargo build --release
-
Tiny profile:
cargo build --profile=release-tiny
-
Fast profile:
cargo build --profile=release-fast
Each scheduler is its own Cargo package. You can build a single one using:
cargo build --profile=<profile> -p <scheduler_name>Example for scx_flash with release-tiny:
cargo build --profile=release-tiny -p scx_flash| Scheduler name | Example build command |
|---|---|
scx_bpfland |
cargo build --release -p scx_bpfland |
scx_chaos |
cargo build --release -p scx_chaos |
scx_cosmos |
cargo build --release -p scx_cosmos |
scx_flash |
cargo build --release -p scx_flash |
scx_lavd |
cargo build --release -p scx_lavd |
scx_layered |
cargo build --release -p scx_layered |
scx_mitosis |
cargo build --release -p scx_mitosis |
scx_p2dq |
cargo build --release -p scx_p2dq |
scx_rlfifo |
cargo build --release -p scx_rlfifo |
scx_rustland |
cargo build --release -p scx_rustland |
scx_rusty |
cargo build --release -p scx_rusty |
scx_tickless |
cargo build --release -p scx_tickless |
scx_wd40 |
cargo build --release -p scx_wd40 |
Besides schedulers, the workspace includes several tools:
-
scxtop – Monitoring tool:
cargo build --release -p scxtop
-
scxcash – Caching utility:
cargo build --release -p scxcash
-
vmlinux_docify – Kernel documentation generator:
cargo build --release -p vmlinux_docify
Some schedulers and tools may also be available directly from crates.io. This allows you to install them without cloning the repository.
| Crate name | Install command |
|---|---|
scxtop |
cargo install scxtop |
scx_flash |
cargo install scx_flash |
This will place the binary in ~/.cargo/bin, which you should add to your PATH if it is not already included.
Note: Availability on crates.io depends on which components the maintainers publish there. Not all schedulers may be published.
To make a scheduler or tool available system-wide, you can either:
-
Copy the installed binary from
~/.cargo/bininto a system directory, e.g.:sudo cp ~/.cargo/bin/scxtop /usr/local/bin/ -
Or add
~/.cargo/binto your systemPATH, for example by adding this line to~/.bashrcor~/.zshrc:export PATH="$HOME/.cargo/bin:$PATH"
To verify the correctness of the build, you can run tests:
-
For the entire workspace:
cargo test -
For a specific scheduler:
cargo test -p scx_flash
The workspace uses a shared Cargo.lock file.
-
To prefetch dependencies for offline builds:
cargo fetch --locked
-
To update dependencies:
cargo update
You can build for different targets, for example musl:
cargo build --release --target x86_64-unknown-linux-muslMake sure the target is installed first:
rustup target add x86_64-unknown-linux-musl-
Enable backtraces:
sudo env RUST_BACKTRACE=1 ./target/debug/scx_flash
-
Enable debug logging:
sudo env RUST_LOG=debug ./target/debug/scx_flash
To remove build artifacts and start fresh:
cargo clean- Build everything:
cargo build --release - Build one scheduler:
cargo build --profile=<profile> -p <name> - Install from crates.io:
cargo install <crate_name> - Make available system-wide: copy binary to
/usr/local/binor add~/.cargo/bintoPATH - Run tests:
cargo test - Cross-compile:
cargo build --target=<target> - Profiles available:
release,release-tiny,release-fast
This approach allows you to build and test either the whole project at once or focus on a single scheduler or tool.