Skip to contentSkip to conversation

tools/sched_ext/scx_userland: fix stale data on restart.

PATCH Applied David Carlier 2 participants 2 messages Feb 14 – Feb 17 Scheduler - sched_ext

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/sched_ext/scx_userland: fix stale data on restart.

we reset all counters, tasks and vruntime_head list.

---
 tools/sched_ext/scx_userland.c | 8 ++++++++
 1 file changed, 8 insertions(+)
tools/sched_ext/scx_userland.c +8 -0
index 63f89b35d999..504a80824f5c 100644
@@ -375,6 +375,14 @@ static void pre_bootstrap(int argc, char **argv)
 static void bootstrap(char *comm)
 {
 	exit_req = 0;
+	min_vruntime = 0.0;
+	nr_vruntime_enqueues = 0;
+	nr_vruntime_dispatches = 0;
+	nr_vruntime_failed = 0;
+	nr_curr_enqueued = 0;
+	memset(tasks, 0, pid_max * sizeof(*tasks));
+	LIST_INIT(&vruntime_head);
+
 	skel = SCX_OPS_OPEN(userland_ops, scx_userland);
 
 	skel->rodata->num_possible_cpus = libbpf_num_possible_cpus();
Signature · 1 line
2.51.0
reviewer Applied
#1 lore raw

Applied to sched_ext/for-7.0-fixes with minor commit message cleanup.

Thanks.

--
tejun