commit | b151b29530a2e49308f0d4190181c04c75b1aa48 | [log] [tgz] |
---|---|---|
author | Daniel Bristot de Oliveira <bristot@redhat.com> | Fri Jul 02 11:46:37 2021 +0200 |
committer | Daniel Bristot de Oliveira <bristot@redhat.com> | Fri Jul 02 11:46:37 2021 +0200 |
tree | 073d1f7c1fba3b84c9df9c9dbfc0d678f9a0b74a | |
parent | 02dbb6fb269f4de525fc7a0ae3c73aca87a18e05 [diff] |
stalld v1.13 This is version v1.13 of stalld. It includes some significant changes. The service script now restarts stalld if it fails. The single-threaded mode was improved with an overload control. Previous, the single-threaded mode boosts a single thread per cpu at a time. This was a disadvantage when compared to the multithreaded methods. Now, when more than one starving thread is detected, the cpu is marked as overloaded. After boosting the longest starving threads at the main thread loop, check if any of the CPUs were overloaded. If so, instead of sleeping until the next programmed check, skip the sleep and check for starving threads again. Thus giving a chance for the other thread to be selected. While this will consume a little bit more CPU when the granularity is considerably larger than the boost period, the chances are that other CPUs will also have new starving threads. With the overload control in place, the single-threaded mode becomes the best one and is now the default. The kernel v5.13 has changed the path to /proc/sched_debug to $debugfs/sched/debug. This version is aware of this change and tries to access both /proc/sched_debug, and $debugfs/sched/debug. Changes: 01eb3ce utils.c: Make the path to sched_debug path dynamic 6d0b834 utils.c: Fail if user is not root 4316bc8 stalld: Make single-threaded mode the default one 47723ac stalld: Fallback to the adaptive mode if force_fifo is selected c04eea8 stalld: Use the last mode set in the cmdline 398c5a9 stalld: Add the adaptive mode option 8f49a3a stalld: Add the overload control to the single-threaded mode d9e10a6 stalld: Fix log message on boost_cpu_starving_vector() 1e1732f stalld.service: Always restart stalld on exit Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
The stalld program (which stands for ‘stall daemon’) is a mechanism to prevent the starvation of operating system threads in a Linux system. The premise is to start up on a housekeeping cpu (one that is not used for real-application purposes) and to periodically monitor the state of each thread in the system, looking for a thread that has been on a run queue (i.e. ready to run) for a specifed length of time without being run. This condition is usually hit when the thread is on the same cpu as a high-priority cpu-intensive task and therefore is being given no opportunity to run.
When a thread is judged to be starving, stalld changes that thread to use the SCHED_DEADLINE policy and gives the thread a small slice of time for that cpu (specified on the command line). The thread then runs and when that timeslice is used, the thread is then returned to its original scheduling policy and stalld then continues to monitor thread states.
There is now an experimental option to boost using SCHED_FIFO. This logic is used if the running kernel does not support the SCHED_DEADLINE policy and may be forced by using the -F/--force_fifo option.
Usage: stalld [-l] [-v] [-k] [-s] [-f] [-h] [-F] [-c cpu-list] [-p time in ns] [-r time in ns] [-d time in seconds] [-t time in seconds]
The repository at https://gitlab.com/rt-linux-tools/stalld is the main repository, where the development takes place.
The repository at https://git.kernel.org/pub/scm/utils/stalld/stalld.git is the distribution repository, where distros can pick the latest released version.