Merge pull request #109 from sirlucjan/services-rework

Reworking systemd-service and adding a config file
This commit is contained in:
David Vernet 2024-01-26 22:49:00 -06:00 committed by GitHub
commit 46ba5908ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 42 additions and 131 deletions

View File

@ -3,30 +3,42 @@
This guide provides instructions for running the SCX schedulers as a systemd service and checking its logs. This guide provides instructions for running the SCX schedulers as a systemd service and checking its logs.
## Getting Started ## 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: To start the SCX scheduler at boot, you need to run the systemd service as root. Here are the steps:
- Enable the service: - Enable the service:
``` ```
systemctl enable scx_SCHEDNAME systemctl enable scx.service
``` ```
- Start the service: - Start the service:
``` ```
systemctl start scx_SCHEDNAME systemctl start scx.service
``` ```
Alternatively, you can use a shortened version of these commands: Alternatively, you can use a shortened version of these commands:
``` ```
systemctl enable --now scx_SCHEDNAME systemctl enable --now scx.service
``` ```
- To check the status of the service, use the following command: - To check the status of the service, use the following command:
``` ```
systemctl status scx_SCHEDNAME systemctl status scx.service
``` ```
## Checking Journald Logs ## Checking Journald Logs

View File

@ -2,7 +2,7 @@ systemd_system_unit_dir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir
install_data( install_data(
[ [
'scx_central.service', 'scx_flatcg.service', 'scx_nest.service', 'scx_pair.service', 'scx_qmap.service', 'scx_rustland.service', 'scx_rusty.service', 'scx_simple.service', 'scx_userland.service', 'scx.service',
], ],
install_dir: systemd_system_unit_dir install_dir: systemd_system_unit_dir
) )
@ -14,3 +14,9 @@ systemd_system_unit_dir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir
install_dir: '/etc/systemd' install_dir: '/etc/systemd'
) )
install_data(
[
'scx',
],
install_dir: '/etc/default'
)

5
services/scx Normal file
View File

@ -0,0 +1,5 @@
# List of scx_schedulers: scx_central scx_flatcg scx_layered scx_nest scx_pair scx_qmap scx_rustland scx_rusty scx_simple scx_userland
SCX_SCHEDULER=scx_rusty
# Set custom flags for each scheduler, below is an example of how to use
#SCX_FLAGS='-s 3000 -i 0.5 -I 0.025 -l 0.5 -b -k'

14
services/scx.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=Start scx_scheduler
ConditionPathIsDirectory=/sys/kernel/sched_ext
[Service]
Type=simple
EnvironmentFile=/etc/default/scx
ExecStart=/bin/bash -c 'exec $SCX_SCHEDULER $SCX_FLAGS '
Restart=always
StandardError=journal
LogNamespace=sched-ext
[Install]
WantedBy=multi-user.target

View File

@ -1,14 +0,0 @@
[Unit]
Description=Start scx_central
ConditionPathIsDirectory=/sys/kernel/sched_ext
Conflicts=scx_flatcg.service scx_nest.service scx_pair.service scx_qmap.service scx_rustland.service scx_rusty.service scx_simple.service scx_userland.service
[Service]
Type=simple
ExecStart=scx_central
Restart=always
StandardError=journal
LogNamespace=sched-ext
[Install]
WantedBy=multi-user.target

View File

@ -1,14 +0,0 @@
[Unit]
Description=Start scx_flatcg
ConditionPathIsDirectory=/sys/kernel/sched_ext
Conflicts=scx_central.service scx_nest.service scx_pair.service scx_qmap.service scx_rustland.service scx_rusty.service scx_simple.service scx_userland.service
[Service]
Type=simple
ExecStart=scx_flatcg
Restart=always
StandardError=journal
LogNamespace=sched-ext
[Install]
WantedBy=multi-user.target

View File

@ -1,14 +0,0 @@
[Unit]
Description=Start scx_nest
ConditionPathIsDirectory=/sys/kernel/sched_ext
Conflicts=scx_central.service scx_flatcg.service scx_pair.service scx_qmap.service scx_rustland.service scx_rusty.service scx_simple.service scx_userland.service
[Service]
Type=simple
ExecStart=scx_nest
Restart=always
StandardError=journal
LogNamespace=sched-ext
[Install]
WantedBy=multi-user.target

View File

@ -1,14 +0,0 @@
[Unit]
Description=Start scx_pair
ConditionPathIsDirectory=/sys/kernel/sched_ext
Conflicts=scx_central.service scx_flatcg.service scx_nest.service scx_qmap.service scx_rustland.service scx_rusty.service scx_simple.service scx_userland.service
[Service]
Type=simple
ExecStart=scx_pair
Restart=always
StandardError=journal
LogNamespace=sched-ext
[Install]
WantedBy=multi-user.target

View File

@ -1,14 +0,0 @@
[Unit]
Description=Start scx_qmap
ConditionPathIsDirectory=/sys/kernel/sched_ext
Conflicts=scx_central.service scx_flatcg.service scx_nest.service scx_pair.service scx_rustland.service scx_rusty.service scx_simple.service scx_userland.service
[Service]
Type=simple
ExecStart=scx_qmap
Restart=always
StandardError=journal
LogNamespace=sched-ext
[Install]
WantedBy=multi-user.target

View File

@ -1,14 +0,0 @@
[Unit]
Description=Start scx_rustland
ConditionPathIsDirectory=/sys/kernel/sched_ext
Conflicts=scx_central.service scx_flatcg.service scx_nest.service scx_pair.service scx_qmap.service scx_rusty.service scx_simple.service scx_userland.service
[Service]
Type=simple
ExecStart=scx_rustland
Restart=always
StandardError=journal
LogNamespace=sched-ext
[Install]
WantedBy=multi-user.target

View File

@ -1,14 +0,0 @@
[Unit]
Description=Start scx_rusty
ConditionPathIsDirectory=/sys/kernel/sched_ext
Conflicts=scx_central.service scx_flatcg.service scx_nest.service scx_pair.service scx_qmap.service scx_rustland.service scx_simple.service scx_userland.service
[Service]
Type=simple
ExecStart=scx_rusty
Restart=always
StandardError=journal
LogNamespace=sched-ext
[Install]
WantedBy=multi-user.target

View File

@ -1,14 +0,0 @@
[Unit]
Description=Start scx_simple
ConditionPathIsDirectory=/sys/kernel/sched_ext
Conflicts=scx_central.service scx_flatcg.service scx_nest.service scx_pair.service scx_qmap.service scx_rustland.service scx_rusty.service scx_userland.service
[Service]
Type=simple
ExecStart=scx_simple
Restart=always
StandardError=journal
LogNamespace=sched-ext
[Install]
WantedBy=multi-user.target

View File

@ -1,14 +0,0 @@
[Unit]
Description=Start scx_userland
ConditionPathIsDirectory=/sys/kernel/sched_ext
Conflicts=scx_central.service scx_flatcg.service scx_nest.service scx_pair.service scx_qmap.service scx_rustland.service scx_rusty.service scx_simple.service
[Service]
Type=simple
ExecStart=scx_userland
Restart=always
StandardError=journal
LogNamespace=sched-ext
[Install]
WantedBy=multi-user.target