Crafting a Linux kernel scheduler in Rust
summary
A user-space Linux CPU scheduler called scx_rustland is implemented in Rust via sched-ext and BPF, proving a kernel-like scheduler can run outside the kernel, be loaded/unloaded at runtime, and be watchdog-protected. The prototype beats the upstream scheduler in a gaming kernel‑build stress test (60 FPS vs ~26 FPS) by prioritizing voluntary context‑switching pipeline threads. BPF verifier limits, stack/instruction caps, and occasional session/page‑fault workarounds remain; the design is suitable for rapid prototyping and eventual kernel reimplementation.
AI-written summary · about
chapters (17)
- 0:00Linux kernel scheduling intro
- 4:22Single scheduler challenges
- 7:11BPF and skx schedulers
- 11:46BPF limits with Rust
- 16:08Rustland scheduler demo
- 22:17Rustland vs default scheduler
- 25:07Scheduler dev framework
- 28:19AI scheduler dev
- 30:04Performance results
- 31:53Rust for kernel scheduling
- 33:18Extending BPF to subsystems
- 36:29Dynamic scheduler loading
- 39:40Q&A: Scheduler selection
- 42:50Q&A: BPF overhead potential
- 46:24Q&A: Safety risks
- 49:41Q&A: BPF vs Rust scheduling
- 52:09Q&A: Overhead directions
related talks
45mExploring AI-powered kernel schedulers with Rust
51mRust in the Linux kernel
36mRust in the Kernel (via eBPF)
33mMoving kernel swapping infrastructure to Rust
39mFrom C to Rust: Bringing Rust Abstractions to Embedded Linux
46mTracing the Linux kernel with eBPF and Rust
39mFrom C to Rust: Bringing Rust Abstractions to Embedded Linux
24mRust for Linux: Status Update
