Files
Andrea Righi 9a1d58ca5c scheds: Introduce scx_tickless
scx_tickless is a server-oriented scheduler, derived from scx_central,
designed to minimize OS noise and maximize performance isolation.

The scheduler works by routing all scheduling events through a pool of
primary CPUs assigned to handle these events. This allows disabling the
scheduler's tick on other CPUs, reducing OS noise.

Tasks are added to a global DSQ, and the primary CPUs distribute them
across the other "tickless" CPUs, sending preemption events via IPC in
case multiple tasks are competing for the same CPU.

In situations where the system is not overcommitted, tasks can run
uninterrupted on their assigned CPUs, leading to better performance
isolation and lower OS noise.

Typical use cases include cloud computing, virtualization and high
performance computing workloads. This scheduler is *not* designed for
latency-sensitive workloads.

NOTE: in order to effectively disable ticks on the "tickless" CPUs the
kernel must be booted with nohz_full.

Example:

 - start a VM running a CPU-intensive workload:

   $ vng -vr -- stress-ng -c 0

 - on the host measure the rate of sched_tick events/sec:

   $ bpftrace -e 'kprobe:sched_tick { @ticks++; } interval:s:1 { print(@ticks); clear(@ticks); }'

With the default scheduler:
 @ticks: 1027
 @ticks: 1021
 @ticks: 1016
 @ticks: 1016
 @ticks: 1029
 @ticks: 1024
 @ticks: 1015
 @ticks: 1022
 @ticks: 1014
 @ticks: 1056
 ...

With scx_tickless:
 @ticks: 1000
 @ticks: 1001
 @ticks: 1001
 @ticks: 1000
 @ticks: 1001
 @ticks: 1000
 @ticks: 1000
 @ticks: 1002
 @ticks: 1000
 @ticks: 1000
 ...

Tested-by: Piotr Gorski <piotrgorski@cachyos.org>
Signed-off-by: Andrea Righi <arighi@nvidia.com>
2025-03-05 00:13:48 +01:00
..
2024-09-05 18:19:01 +02:00
2024-08-30 18:54:52 +02:00
2025-03-05 00:13:48 +01:00

A Quick Start Guide

This guide provides instructions for running the SCX schedulers as a systemd service and checking its logs.

Getting Started

At the very beginning, configure the /etc/default/scx file:

  • in the SCX_SCHEDULER variable, select the scheduler you are interested in

  • in the SCX_FLAGS variable, specify the flags you want to add. To do this, execute and read what flags you can add.

scx_SCHEDNAME --help

To start the SCX scheduler at boot, you need to run the systemd service as root. Here are the steps:

  • Enable the service:
systemctl enable scx.service
  • Start the service:
systemctl start scx.service

Alternatively, you can use a shortened version of these commands:

systemctl enable --now scx.service
  • To check the status of the service, use the following command:
systemctl status scx.service

Override global configuration

It is possible to override the global scx settings using systemd environment variables SCX_SCHEDULER_OVERRIDE and SCX_FLAGS_OVERRIDE.

Example:

systemctl set-environment SCX_SCHEDULER_OVERRIDE=scx_rustland
systemctl set-environment SCX_FLAGS_OVERRIDE="-s 10000"
systemctl restart scx

If you want to restore the default value from the /etc/default/scx file execute:

systemctl unset-environment SCX_SCHEDULER_OVERRIDE
systemctl unset-environment SCX_FLAGS_OVERRIDE
systemctl restart scx

Checking journald Logs

  • To view the logs, use the following command:
journalctl -u scx.service
  • To view the logs of the current session use the command
journalctl -u scx.service -b 0