14 stable releases
| 1.0.17 | Oct 7, 2025 |
|---|---|
| 1.0.15 | Aug 13, 2025 |
| 1.0.14 | Jul 8, 2025 |
| 1.0.10 | Mar 6, 2025 |
| 1.0.6 | Nov 6, 2024 |
#483 in Concurrency
332 downloads per month
Used in scxctl
50KB
961 lines
scx_loader: A DBUS Interface for Managing sched_ext Schedulers
scx_loader is a utility that provides a convenient DBUS interface for starting, stopping, and managing sched_ext schedulers.
Features
StartSchedulerMethod: Launches a scheduler specified by itsscx_name(e.g., "scx_rusty") and a scheduler mode (profile) represented as an unsigned integer.StartSchedulerWithArgsMethod: Starts a scheduler with itsscx_nameand allows passing arbitrary CLI arguments directly to the scheduler.StopSchedulerMethod: Terminates the currently running scheduler.SwitchSchedulerMethod: Stops the current scheduler and starts the specified scheduler with the given mode.SwitchSchedulerWithArgsMethod: Stops the current scheduler and starts the specified scheduler with the provided arguments.CurrentSchedulerProperty: Returns thescx_nameof the active scheduler or "unknown" if none is running.SchedulerModeProperty: Provides information about the currently active scheduler's mode (profile).SupportedSchedulersProperty: Lists the schedulers currently supported byscx_loader.
Usage
scx_loader interacts with schedulers through its DBUS interface. You can use tools like dbus-send or gdbus to communicate with it.
Examples using dbus-send:
-
Start a Scheduler:
dbus-send --system --print-reply --dest=org.scx.Loader /org/scx/Loader org.scx.Loader.StartScheduler string:scx_rusty uint32:0(This starts
scx_rustywith scheduler mode 0) -
Start a Scheduler with Arguments:
dbus-send --system --print-reply --dest=org.scx.Loader /org/scx/Loader org.scx.Loader.StartSchedulerWithArgs string:scx_bpfland array:string:"-p","-s","5000"(This starts
scx_bpflandwith arguments-p -s 5000) -
Stop the Current Scheduler:
dbus-send --system --print-reply --dest=org.scx.Loader /org/scx/Loader org.scx.Loader.StopScheduler -
Switch Scheduler:
dbus-send --system --print-reply --dest=org.scx.Loader /org/scx/Loader org.scx.Loader.SwitchScheduler string:scx_lavd uint32:2(This switches to
scx_lavdwith scheduler mode 2) -
Switch Scheduler with Arguments:
dbus-send --system --print-reply --dest=org.scx.Loader /org/scx/Loader org.scx.Loader.SwitchSchedulerWithArgs string:scx_bpfland array:string:"-p","-s","5000"(This switches to
scx_bpflandwith arguments-p -s 5000) -
Get the Currently Active Scheduler:
dbus-send --system --print-reply --dest=org.scx.Loader /org/scx/Loader org.freedesktop.DBus.Properties.Get string:org.scx.Loader string:CurrentScheduler -
Get the Supported Schedulers:
dbus-send --system --print-reply --dest=org.scx.Loader /org/scx/Loader org.freedesktop.DBus.Properties.Get string:org.scx.Loader string:SupportedSchedulers
Note: Replace the example scheduler names and arguments with the actual ones you want to use.
DBUS and Systemd Service
scx_loader provides the org.scx.Loader DBUS service and is automatically started by dbus-daemon when an application calls into this service. Users and administrators do not need to manually start the scx_loader daemon.
scx_loader is managed by the scx_loader.service systemd unit. This service is distinct from the scx.service unit, which is used to manage schedulers directly (without DBUS).
Debugging
In case of issues with scx_loader, you can debug the service using the following steps:
-
Check the service status:
systemctl status scx_loader.service -
View the service logs:
journalctl -u scx_loader.service -
Enable debug logging: You can temporarily enable debug logging by modifying the systemd service file:
-
Edit the service file:
sudo systemctl edit scx_loader.service -
Add the following lines under the
[Service]section:Environment=RUST_LOG=trace -
Restart the service:
sudo systemctl restart scx_loader.service -
Check the logs again for detailed debugging information.
-
D-Bus Introspection XML
scx_loader provides a D-Bus Introspection XML file that describes its interface. This file can be used by language bindings and tools to interact with the service.
Using the Introspection XML:
The introspection XML can be accessed in two ways:
-
Through the D-Bus introspection interface:
dbus-send --system --print-reply --dest=org.scx.Loader /org/scx/Loader org.freedesktop.DBus.Introspectable.IntrospectThis will output the XML describing the
scx_loaderinterface. -
From the project repository:
The XML file is also available in the provided file
org.scx.Loader.xml.
You can then use this XML with tools like gdbus-codegen or other language-specific D-Bus bindings to generate code that interacts with scx_loader.
For example, with gdbus-codegen, you can generate C code for the interface:
gdbus-codegen --generate-c-code scx-loader-bindings org.scx.Loader.xml
This will produce header and source files that you can use to interact with scx_loader from your C code.
Development Status
scx_loader is under active development. Future improvements may include:
- More robust error handling.
Dependencies
~14–30MB
~444K SLoC