[PATCH 7/9] tools/sched_ext: scx_qmap: Reset the hier stats baseline on restart
From: Tao Cui
Date: Tue Nov 10 2026 - 07:53:03 EST
From: Tao Cui <cuitao@xxxxxxxxxx>
hprev holds the previous per-participant counter snapshots for the
hier stats deltas and is initialized before the restart: label, so a
hotplug-triggered fail-safe reload leaves it holding snapshots from
the previous generation while the scheduler's own counters start from
zero; the first stats interval prints u64-underflow garbage.
Reset it together with optind on reload.
Fixes: e9151ed5c944 ("tools/sched_ext: scx_qmap - Expand hierarchical sub-scheduling")
Signed-off-by: Tao Cui <cuitao@xxxxxxxxxx>
---
tools/sched_ext/scx_qmap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/sched_ext/scx_qmap.c b/tools/sched_ext/scx_qmap.c
index f44802247069..414afb817e0a 100644
--- a/tools/sched_ext/scx_qmap.c
+++ b/tools/sched_ext/scx_qmap.c
@@ -292,6 +292,7 @@ int main(int argc, char **argv)
}
restart:
optind = 1;
+ memset(&hprev, 0, sizeof(hprev));
skel = SCX_OPS_CID_OPEN(qmap_ops, scx_qmap);
skel->rodata->slice_ns = skel->rodata->__SCX_SLICE_DFL;
--
2.53.0
base-commit: 5b740a72b55c4267ba4d8010f17dde26b26f52d3