mirror of
https://github.com/JakeHillion/scx.git
synced 2024-11-25 11:00:24 +00:00
scx_loader: add scx_flash as supported scheduler
This commit is contained in:
parent
489ce8a766
commit
d5d4f463f9
@ -36,12 +36,18 @@ auto_mode = []
|
||||
gaming_mode = ["--performance"]
|
||||
lowlatency_mode = ["--performance"]
|
||||
powersave_mode = ["--powersave"]
|
||||
|
||||
[scheds.scx_flash]
|
||||
auto_mode = []
|
||||
gaming_mode = []
|
||||
lowlatency_mode = []
|
||||
powersave_mode = []
|
||||
```
|
||||
|
||||
**`default_sched`:**
|
||||
|
||||
* This field specifies the scheduler that will be started automatically when `scx_loader` starts (e.g., on boot).
|
||||
* It should be set to the name of a supported scheduler (e.g., `"scx_bpfland"`, `"scx_rusty"`, `"scx_lavd"`).
|
||||
* It should be set to the name of a supported scheduler (e.g., `"scx_bpfland"`, `"scx_rusty"`, `"scx_lavd"`, `"scx_flash"`).
|
||||
* If this field is not present or is set to an empty string, no scheduler will be started automatically.
|
||||
|
||||
**`default_mode`:**
|
||||
@ -52,7 +58,7 @@ powersave_mode = ["--powersave"]
|
||||
|
||||
**`[scheds.scx_name]`:**
|
||||
|
||||
* This section defines the custom flags for a specific scheduler. Replace `scx_name` with the actual name of the scheduler (e.g., `scx_bpfland`, `scx_rusty`, `scx_lavd`).
|
||||
* This section defines the custom flags for a specific scheduler. Replace `scx_name` with the actual name of the scheduler (e.g., `scx_bpfland`, `scx_rusty`, `scx_lavd`, `scx_flash`).
|
||||
|
||||
**`auto_mode`, `gaming_mode`, `lowlatency_mode`, `powersave_mode`:**
|
||||
|
||||
@ -74,6 +80,8 @@ The example configuration above shows how to set custom flags for different sche
|
||||
* Gaming mode: `--performance`
|
||||
* Low Latency mode: `--performance`
|
||||
* Power Save mode: `--powersave`
|
||||
* For `scx_flash`:
|
||||
* No custom flags are defined, so the default flags for each mode will be used.
|
||||
|
||||
## Fallback Behavior
|
||||
|
||||
|
@ -88,6 +88,10 @@ pub fn get_default_config() -> Config {
|
||||
"scx_lavd".to_string(),
|
||||
get_default_sched_for_config(&SupportedSched::Lavd),
|
||||
),
|
||||
(
|
||||
"scx_flash".to_string(),
|
||||
get_default_sched_for_config(&SupportedSched::Flash),
|
||||
),
|
||||
]),
|
||||
}
|
||||
}
|
||||
@ -176,6 +180,8 @@ fn get_default_scx_flags_for_mode(scx_sched: &SupportedSched, sched_mode: SchedM
|
||||
},
|
||||
// scx_rusty doesn't support any of these modes
|
||||
SupportedSched::Rusty => vec![],
|
||||
// scx_flash doesn't support any of these modes
|
||||
SupportedSched::Flash => vec![],
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,6 +211,12 @@ auto_mode = []
|
||||
gaming_mode = ["--performance"]
|
||||
lowlatency_mode = ["--performance"]
|
||||
powersave_mode = ["--powersave"]
|
||||
|
||||
[scheds.scx_flash]
|
||||
auto_mode = []
|
||||
gaming_mode = []
|
||||
lowlatency_mode = []
|
||||
powersave_mode = []
|
||||
"#;
|
||||
|
||||
let parsed_config = parse_config_content(config_str).expect("Failed to parse config");
|
||||
|
@ -39,6 +39,8 @@ enum SupportedSched {
|
||||
Rusty,
|
||||
#[serde(rename = "scx_lavd")]
|
||||
Lavd,
|
||||
#[serde(rename = "scx_flash")]
|
||||
Flash,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
@ -114,7 +116,7 @@ impl ScxLoader {
|
||||
/// Get list of supported schedulers
|
||||
#[zbus(property)]
|
||||
async fn supported_schedulers(&self) -> Vec<&str> {
|
||||
vec!["scx_bpfland", "scx_rusty", "scx_lavd"]
|
||||
vec!["scx_bpfland", "scx_rusty", "scx_lavd", "scx_flash"]
|
||||
}
|
||||
|
||||
async fn start_scheduler(
|
||||
@ -546,6 +548,7 @@ fn get_scx_from_str(scx_name: &str) -> zbus::fdo::Result<SupportedSched> {
|
||||
"scx_bpfland" => Ok(SupportedSched::Bpfland),
|
||||
"scx_rusty" => Ok(SupportedSched::Rusty),
|
||||
"scx_lavd" => Ok(SupportedSched::Lavd),
|
||||
"scx_flash" => Ok(SupportedSched::Flash),
|
||||
_ => Err(zbus::fdo::Error::Failed(format!(
|
||||
"{scx_name} is not supported"
|
||||
))),
|
||||
@ -558,5 +561,6 @@ fn get_name_from_scx(supported_sched: &SupportedSched) -> &'static str {
|
||||
SupportedSched::Bpfland => "scx_bpfland",
|
||||
SupportedSched::Rusty => "scx_rusty",
|
||||
SupportedSched::Lavd => "scx_lavd",
|
||||
SupportedSched::Flash => "scx_flash",
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user