Switching the scheduler requires changing SCX_SCHEDULER (and potentially
also SCX_FLAGS) in /etc/default/scx.
This patch allows overriding these settings using systemd environment
variables SCX_SCHEDULER_OVERRIDE and SCX_FLAGS_OVERRIDE, without
changing the default configuration.
Example:
> grep SCX_SCHEDULER /etc/default/scx
SCX_SCHEDULER=scx_rusty
> sudo systemctl status scx
...
Main PID: 8021 (scx_rusty)
...
> sudo systemctl set-environment SCX_SCHEDULER_OVERRIDE=scx_rustland
> sudo systemctl restart scx
> sudo systemctl status scx
...
Main PID: 4021 (scx_rustland)
...
This feature can be useful for quickly testing different schedulers and
settings, without altering the global system configuration.
Signed-off-by: Pietro Righi <pietro.righi.email@gmail.com>
Currently if the scx.service is failing to launch due issues, systemd will try to start the scheduler all the time.
This results into a massive flood to the kernel and does not bring the service up again.
explanation of the changes:
The StartLimitBurst=2 and StartLimitIntervalSec=30 settings tell systemd that if the service unsuccessfully tries to restart itself twice within 30 seconds, it should enter a failed state and no longer try to restart. This ensures that if the service is truly broken, systemd won't continuously try to restart it.
Signed-off-by: Peter Jung <admin@ptr1337.dev>