mirror of
https://github.com/sched-ext/scx.git
synced 2024-12-18 05:47:01 +00:00
scx_loader: add mode for server-oriented workloads
ref: https://github.com/sched-ext/scx/pull/1094
This commit is contained in:
parent
e280e6b2dc
commit
13ec357444
@ -53,14 +53,14 @@ powersave_mode = []
|
||||
**`default_mode`:**
|
||||
|
||||
* This field specifies the default scheduler mode that will be used when starting a scheduler without explicitly specifying a mode.
|
||||
* Possible values are: `"Auto"`, `"Gaming"`, `"LowLatency"`, `"PowerSave"`.
|
||||
* Possible values are: `"Auto"`, `"Gaming"`, `"LowLatency"`, `"PowerSave"`, `"Server"`.
|
||||
* If this field is not present, it defaults to `"Auto"`.
|
||||
|
||||
**`[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`, `scx_flash`).
|
||||
|
||||
**`auto_mode`, `gaming_mode`, `lowlatency_mode`, `powersave_mode`:**
|
||||
**`auto_mode`, `gaming_mode`, `lowlatency_mode`, `powersave_mode`, `server_mode`:**
|
||||
|
||||
* These fields specify the flags to be used for each scheduler mode.
|
||||
* Each field is an array of strings, where each string represents a flag.
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
<!--
|
||||
SchedulerMode:
|
||||
@sched_mode: 0 = Auto, 1 = Gaming, 2 = PowerSave, 3 = LowLatency
|
||||
@sched_mode: 0 = Auto, 1 = Gaming, 2 = PowerSave, 3 = LowLatency, 4 = Server
|
||||
|
||||
The currently active scheduler mode. Scheduler modes allow you to
|
||||
apply pre-defined configurations to a scheduler that are
|
||||
|
@ -30,6 +30,7 @@ pub struct Sched {
|
||||
pub gaming_mode: Option<Vec<String>>,
|
||||
pub lowlatency_mode: Option<Vec<String>>,
|
||||
pub powersave_mode: Option<Vec<String>>,
|
||||
pub server_mode: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
/// Initialize config from first found config path, overwise fallback to default config
|
||||
@ -130,6 +131,7 @@ fn extract_scx_flags_from_config(
|
||||
SchedMode::Gaming => sched_config.gaming_mode.clone(),
|
||||
SchedMode::LowLatency => sched_config.lowlatency_mode.clone(),
|
||||
SchedMode::PowerSave => sched_config.powersave_mode.clone(),
|
||||
SchedMode::Server => sched_config.server_mode.clone(),
|
||||
SchedMode::Auto => sched_config.auto_mode.clone(),
|
||||
}
|
||||
}
|
||||
@ -161,6 +163,12 @@ fn get_default_sched_for_config(scx_sched: &SupportedSched) -> Sched {
|
||||
.map(String::from)
|
||||
.collect(),
|
||||
),
|
||||
server_mode: Some(
|
||||
get_default_scx_flags_for_mode(scx_sched, SchedMode::Server)
|
||||
.into_iter()
|
||||
.map(String::from)
|
||||
.collect(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,13 +179,14 @@ fn get_default_scx_flags_for_mode(scx_sched: &SupportedSched, sched_mode: SchedM
|
||||
SchedMode::Gaming => vec!["-m", "performance"],
|
||||
SchedMode::LowLatency => vec!["-k", "-s", "5000", "-l", "5000"],
|
||||
SchedMode::PowerSave => vec!["-m", "powersave"],
|
||||
SchedMode::Server => vec!["-c", "0"],
|
||||
SchedMode::Auto => vec![],
|
||||
},
|
||||
SupportedSched::Lavd => match sched_mode {
|
||||
SchedMode::Gaming | SchedMode::LowLatency => vec!["--performance"],
|
||||
SchedMode::PowerSave => vec!["--powersave"],
|
||||
// NOTE: potentially adding --auto in future
|
||||
SchedMode::Auto => vec![],
|
||||
SchedMode::Server | SchedMode::Auto => vec![],
|
||||
},
|
||||
// scx_rusty doesn't support any of these modes
|
||||
SupportedSched::Rusty => vec![],
|
||||
@ -200,24 +209,28 @@ auto_mode = []
|
||||
gaming_mode = ["-m", "performance"]
|
||||
lowlatency_mode = ["-k", "-s", "5000", "-l", "5000"]
|
||||
powersave_mode = ["-m", "powersave"]
|
||||
server_mode = ["-c", "0"]
|
||||
|
||||
[scheds.scx_rusty]
|
||||
auto_mode = []
|
||||
gaming_mode = []
|
||||
lowlatency_mode = []
|
||||
powersave_mode = []
|
||||
server_mode = []
|
||||
|
||||
[scheds.scx_lavd]
|
||||
auto_mode = []
|
||||
gaming_mode = ["--performance"]
|
||||
lowlatency_mode = ["--performance"]
|
||||
powersave_mode = ["--powersave"]
|
||||
server_mode = []
|
||||
|
||||
[scheds.scx_flash]
|
||||
auto_mode = []
|
||||
gaming_mode = []
|
||||
lowlatency_mode = []
|
||||
powersave_mode = []
|
||||
server_mode = []
|
||||
"#;
|
||||
|
||||
let parsed_config = parse_config_content(config_str).expect("Failed to parse config");
|
||||
|
@ -40,6 +40,8 @@ pub enum SchedMode {
|
||||
PowerSave = 2,
|
||||
/// Starts scheduler in low latency mode
|
||||
LowLatency = 3,
|
||||
/// Starts scheduler in server-oriented mode
|
||||
Server = 4,
|
||||
}
|
||||
|
||||
impl From<&SupportedSched> for &str {
|
||||
|
Loading…
Reference in New Issue
Block a user