Skip to content

scx_loader: Allow custom schedulers defined in the config - #81

Merged
vnepogodin merged 1 commit into
sched-ext:mainfrom
mohitmishra786:scx_loader-custom-schedulers
Oct 29, 2026
Merged

vnepogodin merged 1 commit into
sched-ext:mainfrom
mohitmishra786:scx_loader-custom-schedulers

Conversation

@mohitmishra786

Copy link
Copy Markdown
Contributor

scx_loader can only run the schedulers listed in SupportedSched. To run one that isn't upstream yet, for example a scheduler under development, you have to patch that enum (#34).

This adds an opt-in allow_custom_scheds option, off by default. With it set, a [scheds.NAME] entry with an absolute path defines a custom scheduler. The mode fields work the same as for a built-in one:

allow_custom_scheds = true

[scheds.scx_mysched]
path = "/usr/local/bin/scx_mysched"
gaming_mode = ["--fast"]
  • The name must be scx_ followed by lowercase letters, digits or _, and can't be a built-in scheduler.
  • The binary path only comes from the root-owned config. Over D-Bus, clients pick a custom scheduler by name through the existing methods and can't pass a path. A name the config doesn't define is rejected before the polkit check.
  • A path without allow_custom_scheds = true is a config error, so the setting is never silently ignored.
  • Custom schedulers are listed in SupportedSchedulers after the built-in ones, and can be used anywhere a built-in one can, including default_sched.

SupportedSched gets a Custom(String) variant and is serialized as its name. The D-Bus signature stays s, so existing clients keep working. A Custom value can't produce a &'static str, so From<SupportedSched> for &str is replaced by as_str(). Debug still prints built-in schedulers as before, so scxctl's output doesn't change.

A [scheds.NAME] entry without a path for a name scx_loader doesn't know is still accepted and ignored, so configs that list a scheduler scx_loader no longer ships keep loading.

Closes #34

scx_loader can only run the schedulers in SupportedSched. Running a
scheduler that isn't upstream yet, for example one under development,
means patching that enum.

Add an opt-in allow_custom_scheds config option. With it set, a
[scheds.NAME] entry with an absolute `path` defines a custom scheduler,
with the same mode fields as a built-in one. NAME must be `scx_`
followed by lowercase letters, digits or `_`, and must not be built in.
A `path` without the option is a config error rather than being
ignored.

The binary path only ever comes from the root-owned config. Over D-Bus
a custom scheduler is picked by name, through the existing methods, and
a name the config doesn't define is rejected before the polkit check.
Built-in schedulers still run by name from PATH.

SupportedSched gets a Custom(String) variant and is serialized as its
name, so the D-Bus signature stays "s" and existing clients keep
working. SupportedSchedulers lists the custom schedulers after the
built-in ones. Because a Custom value can't produce a &'static str, the
From<SupportedSched> for &str impl is replaced by as_str(). Debug still
prints built-in schedulers as before, so scxctl's output doesn't
change.

A [scheds.NAME] entry without a `path` for a name scx_loader doesn't
know is still accepted and ignored, as before, so configs that list a
scheduler scx_loader no longer ships keep loading.

Link: sched-ext#34
Signed-off-by: Mohit Mishra <immadmohit@gmail.com>
@mohitmishra786

Copy link
Copy Markdown
Contributor Author

Can you @vnepogodin @sirlucjan please review this PR?

@vnepogodin vnepogodin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mohitmishra786

Copy link
Copy Markdown
Contributor Author

@sirlucjan @vnepogodin I see both of you approved this, can this be merged as I don't have merge access
thanks alot

@vnepogodin
vnepogodin merged commit 259bb6c into sched-ext:main Oct 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature idea] add config option to allow custom schedulers

3 participants