scx_intent is an intent-aware, multi-tier CPU scheduler for Linux built on sched_ext using in-kernel BPF.
Instead of treating all threads with homogeneous timeslices or relying solely on runtime heuristics, scx_intent assigns tasks into 5 dedicated BPF Dispatch Queues (DSQs) based on their execution profile. Interactive UI, compositor, and audio tasks receive short, low-latency slices, while heavy throughput/batch tasks run on wider slices to minimize cache thrashing and context-switch overhead.
Tasks are classified inside BPF at enqueue time (ops.enqueue) and dispatched across 5 priority-ranked DSQs:
| Intent Tier | Target Workloads | DSQ ID | Time Slice | Precedence |
|---|---|---|---|---|
INTENT_AUDIT |
Security logging, auditd, live system monitors | 0 | 10 ms | 1 (Highest) |
INTENT_INTERACTIVE |
Wayland compositors, X11, audio engines (PipeWire), shells | 1 | 4 ms | 2 |
INTENT_IO |
Storage I/O workers, database sync/flush operations | 2 | 5 ms | 3 |
INTENT_NETWORK |
Socket handlers, network packet ingress/egress workers | 3 | 8 ms | 4 |
INTENT_COMPUTE |
Compilers (rustc, gcc), batch computations, rendering | 4 | 20 ms | 5 (Lowest) |
- In-Kernel BPF Routing: Dispatch decisions happen entirely in kernel space via BPF iterator and
scx_bpf_dispatch(). No userspace IPC trips in the critical path. - Prioritized Drain: Higher-ranked DSQs are evaluated first on dispatch (
Audit->Interactive->IO->Network->Compute). - Starvation Prevention: Under sustained compute saturation, lower-priority DSQs track missed dispatch opportunities. Once a tier's starvation counter reaches the configured threshold (default: 32 ticks), it is injected directly into the dispatch queue to guarantee forward progress across all tasks.
- Linux Kernel 6.12 or newer with
CONFIG_SCHED_CLASS_EXT=y - Clang / LLVM 17+
- Rust 1.80+ (with Cargo)
bpftoolandlibbpfdevelopment headers
Clone the repository and build with release optimizations:
git clone https://github.com/Exploidus/scx_intent.git
cd scx_intent
# Run with standard desktop preset
cargo run --release
# Run with gaming / low-latency preset
cargo run --release -- --preset gaming
# Run with custom JSON configuration
cargo run --release -- --config intent.example.jsonTo inspect runtime parameters and options:
cargo run --release -- --helpThe concept of dedicated intent classification originally stems from design work on the Exploidus kernel, reimagined and natively rewritten for the Linux sched_ext infrastructure.
GPL-2.0-only