#linux-kernel #task-scheduling #scheduler #deadlines #bpf #low-latency #virtual

app scx_lavd

A Latency-criticality Aware Virtual Deadline (LAVD) scheduler based on 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

10 releases (stable)

1.0.6 Nov 6, 2024
1.0.5 Oct 2, 2024
1.0.4 Sep 7, 2024
1.0.3 Aug 21, 2024
0.1.2 Apr 29, 2024

#603 in Unix APIs

Download history 84/week @ 2024-08-03 21/week @ 2024-08-10 133/week @ 2024-08-17 13/week @ 2024-08-24 165/week @ 2024-09-07 55/week @ 2024-09-14 10/week @ 2024-09-21 193/week @ 2024-09-28 27/week @ 2024-10-05 11/week @ 2024-10-12 1/week @ 2024-10-19 98/week @ 2024-11-02 15/week @ 2024-11-09

114 downloads per month

GPL-2.0-only

160KB
3.5K SLoC

C 2K SLoC // 0.4% comments Rust 1K SLoC // 0.0% comments

scx_lavd

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

scx_lavd is a BPF scheduler that implements an LAVD (Latency-criticality Aware Virtual Deadline) scheduling algorithm. While LAVD is new and still evolving, its core ideas are 1) measuring how much a task is latency critical and 2) leveraging the task's latency-criticality information in making various scheduling decisions (e.g., task's deadline, time slice, etc.). As the name implies, LAVD is based on the foundation of deadline scheduling. This scheduler consists of the BPF part and the rust part. The BPF part makes all the scheduling decisions; the rust part provides high-level information (e.g., CPU topology) to the BPF code, loads the BPF code and conducts other chores (e.g., printing sampled scheduling decisions).

Typical Use Case

scx_lavd is initially motivated by gaming workloads. It aims to improve interactivity and reduce stuttering while playing games on Linux. Hence, this scheduler's typical use case involves highly interactive applications, such as gaming, which requires high throughput and low tail latencies.

Production Ready?

Yes, scx_lavd should be performant across various CPU architectures. It creates a separate scheduling domain per-LLC, per-core type (e.g., P or E core on Intel, big or LITTLE on ARM), and per-NUMA domain, so the default balanced profile or autopilot mode should be performant. It mainly targets single CCX / single-socket systems.

Dependencies

~34–45MB
~659K SLoC