scx/scheds/rust/scx_rlfifo
Andrea Righi d25675ff44 scx_rustland_core: switch to FIFO when system is underutilized
Provide a knob in scx_rustland_core to automatically turn the scheduler
into a simple FIFO when the system is underutilized.

This choice is based on the assumption that, in the case of system
underutilization (less tasks running than the amount of available CPUs),
the best scheduling policy is FIFO.

With this option enabled the scheduler starts in FIFO mode. If most of
the CPUs are busy (nr_running >= num_cpus - 1), the scheduler
immediately exits from FIFO mode and starts to apply the logic
implemented by the user-space component. Then the scheduler can switch
back to FIFO if there are no tasks waiting to be scheduled (evaluated
using a moving average).

This option can be enabled/disabled by the user-space scheduler using
the fifo_sched parameter in BpfScheduler: if set, the BPF component will
periodically check for system utilization and switch back and forth to
FIFO mode based on that.

This allows to improve performance of workloads that are using a small
amount of the available CPUs in the system, while still maintaining the
same good level of performance for interactive tasks when the system is
over commissioned.

In certain video games, such as Baldur's Gate 3 or Counter-Strike 2,
running in "normal" system conditions, we can experience a boost in fps
of approximately 4-8% with this change applied.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-05-21 17:39:11 +02:00
..
src scx_rustland_core: switch to FIFO when system is underutilized 2024-05-21 17:39:11 +02:00
.gitignore scx_rustland_core: generate source files in-tree 2024-02-28 17:49:44 +01:00
build.rs scx_rustland_core: introduce RustLandBuilder() 2024-02-28 17:49:44 +01:00
Cargo.toml scx_rustland_core: use a BPF_MAP_TYPE_USER_RINGBUF to dispatch tasks 2024-05-08 22:16:53 +02:00
LICENSE scx_rlfifo: simple user-space FIFO scheduler written in Rust 2024-02-28 17:49:44 +01:00
meson.build scheds-rust: build rust schedulers in sequence 2024-04-23 08:06:27 +08:00
README.md scx_rlfifo: simple user-space FIFO scheduler written in Rust 2024-02-28 17:49:44 +01:00
rustfmt.toml scx_rlfifo: simple user-space FIFO scheduler written in Rust 2024-02-28 17:49:44 +01:00

scx_rlfifo

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_rlfifo is a simple FIFO scheduler runs in user-space, based on the scx_rustland_core framework.

Typical Use Case

This scheduler is provided as a simple template that can be used as a baseline to test more complex scheduling policies.

Production Ready?

Definitely not. Using this scheduler in a production environment is not recommended, unless there are specific requirements that necessitate a basic FIFO scheduling approach. Even then, it's still recommended to use the kernel's SCHED_FIFO real-time class.