scx_layered: Make config json assume default vaules for unspecified fields

This makes writing configs and allows introducing new fields without
breaking existing configs.
This commit is contained in:
Tejun Heo 2024-03-13 11:10:38 -10:00
parent 60b346c1fc
commit 76fb0fdd8f

View File

@ -302,20 +302,29 @@ enum LayerMatch {
#[derive(Clone, Debug, Serialize, Deserialize)]
enum LayerKind {
Confined {
cpus_range: Option<(usize, usize)>,
util_range: (f64, f64),
#[serde(default)]
cpus_range: Option<(usize, usize)>,
#[serde(default)]
min_exec_us: u64,
},
Grouped {
cpus_range: Option<(usize, usize)>,
util_range: (f64, f64),
#[serde(default)]
cpus_range: Option<(usize, usize)>,
#[serde(default)]
min_exec_us: u64,
#[serde(default)]
preempt: bool,
#[serde(default)]
exclusive: bool,
},
Open {
#[serde(default)]
min_exec_us: u64,
#[serde(default)]
preempt: bool,
#[serde(default)]
exclusive: bool,
},
}