#scx #rusty #scheduler #ebpf

app scx_rusty

A multi-domain, BPF / user space hybrid scheduler used within sched_ext, which is a Linux kernel feature which enables implementing kernel thread schedulers in BPF and dynamically loading them. https://github.com/sched-ext/scx/tree/main

5 releases

0.5.4 Jan 25, 2024
0.5.3 Jan 9, 2024
0.5.2 Jan 4, 2024
0.5.1 Dec 12, 2023
0.5.0 Nov 30, 2023

#182 in Unix APIs

Download history 10/week @ 2023-11-24 14/week @ 2023-12-01 30/week @ 2023-12-08 4/week @ 2023-12-15 6/week @ 2023-12-22 23/week @ 2023-12-29 40/week @ 2024-01-05 9/week @ 2024-01-12 27/week @ 2024-01-19 16/week @ 2024-01-26 5/week @ 2024-02-02 10/week @ 2024-02-09 92/week @ 2024-02-16 199/week @ 2024-02-23

306 downloads per month

GPL-2.0-only

82KB
2K SLoC

Rust 1K SLoC // 0.1% comments C 793 SLoC // 0.2% comments

scx_rusty

This is a single user-defined scheduler used within sched_ext, which is a Linux kernel feature which enables implementing kernel thread schedulers in BPF and dynamically loading them. Read more about sched_ext.

Overview

A multi-domain, BPF / user space hybrid scheduler. The BPF portion of the scheduler does a simple round robin in each domain, and the user space portion (written in Rust) calculates the load factor of each domain, and informs BPF of how tasks should be load balanced accordingly.

How To Install

Available as a Rust crate: cargo add scx_rusty

Typical Use Case

Rusty is designed to be flexible, and accommodate different architectures and workloads. Various load balancing thresholds (e.g. greediness, frequenty, etc), as well as how Rusty should partition the system into scheduling domains, can be tuned to achieve the optimal configuration for any given system or workload.

Production Ready?

Yes. If tuned correctly, rusty should be performant across various CPU architectures and workloads. Rusty by default creates a separate scheduling domain per-LLC, so its default configuration may be performant as well. Note however that scx_rusty does not yet disambiguate between LLCs in different NUMA nodes, so it may perform better on multi-CCX machines where all the LLCs share the same socket, as opposed to multi-socket machines.

Note as well that you may run into an issue with infeasible weights, where a task with a very high weight may cause the scheduler to incorrectly leave cores idle because it thinks they're necessary to accommodate the compute for a single task. This can also happen in CFS, and should soon be addressed for scx_rusty.

Dependencies

~26–39MB
~592K SLoC