[PATCH 2/3] scx_central: Cancel BPF timer during ops.exit
From: Zhao Mengmeng
Date: Wed Apr 08 2026 - 23:24:46 EST
From: Zhao Mengmeng <zhaomengmeng@xxxxxxxxxx>
Cancel the BPF timer in ops.exit, which is called before
free_kick_syncs(), so that new cpu kick will not come and hit the NULL
check in kick_cpus_irq_workfn().
Signed-off-by: Zhao Mengmeng <zhaomengmeng@xxxxxxxxxx>
---
tools/sched_ext/scx_central.bpf.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/sched_ext/scx_central.bpf.c b/tools/sched_ext/scx_central.bpf.c
index 4efcce099bd5..6c2cd5511a25 100644
--- a/tools/sched_ext/scx_central.bpf.c
+++ b/tools/sched_ext/scx_central.bpf.c
@@ -359,7 +359,14 @@ int BPF_STRUCT_OPS_SLEEPABLE(central_init)
void BPF_STRUCT_OPS(central_exit, struct scx_exit_info *ei)
{
+ u32 key = 0;
+ struct bpf_timer *timer;
+
UEI_RECORD(uei, ei);
+
+ timer = bpf_map_lookup_elem(¢ral_timer, &key);
+ if (timer)
+ bpf_timer_cancel(timer);
}
SCX_OPS_DEFINE(central_ops,
--
2.43.0