sched_ext: Use rcu_dereference_bh() in scx_bypass_lb_timerfn()
Subsystems (3)
PATCH 3/5 sched_ext: Use rcu_dereference_bh() in scx_bypass_lb_timerfn()
From: Su Zhidao <[email protected]>
scx_bypass_lb_timerfn() runs in softirq (BH) context, so rcu_dereference_bh() is the correct RCU accessor. The previous rcu_dereference_all() suppresses all sparse warnings and masks potential RCU context issues.
Add a comment noting this is a transitional state: when multi-scheduler support lands, the bypass LB timer will become per-scheduler and the global scx_root reference will be removed.
Signed-off-by Su Zhidao <[email protected]>
--- kernel/sched/ext.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/sched/ext.c +7 -1
@@ -4170,7 +4170,13 @@ static void scx_bypass_lb_timerfn(struct timer_list *timer)int node;u32 intv_us; - sch =rcu_dereference_all (scx_root); +/* +* scx_bypass_lb_timer is a global timer that fires in softirq +* context while bypass mode is active. Use rcu_dereference_bh() +* matching the BH context. When multi-scheduler support lands, +* this timer will become per-scheduler instance. +*/ + sch =rcu_dereference_bh (scx_root);if (unlikely (!sch) || !READ_ONCE (scx_bypass_depth))return ;
Signature · 1 line
2.43.0