From 76fb0fdd8f9b7ad816c5f29f6b4051646a5ac6ed Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Wed, 13 Mar 2024 11:10:38 -1000 Subject: [PATCH] scx_layered: Make config json assume default vaules for unspecified fields This makes writing configs and allows introducing new fields without breaking existing configs. --- scheds/rust/scx_layered/src/main.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scheds/rust/scx_layered/src/main.rs b/scheds/rust/scx_layered/src/main.rs index 32df93c..36e1627 100644 --- a/scheds/rust/scx_layered/src/main.rs +++ b/scheds/rust/scx_layered/src/main.rs @@ -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, }, }