Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched_ext: deprecation warn for scx_bpf_cpu_rq()

scx_bpf_cpu_rq() works on an unlocked rq which generally isn't safe.
For the common use-cases scx_bpf_locked_rq() and
scx_bpf_cpu_curr() work, so add a deprecation warning
to scx_bpf_cpu_rq() so it can eventually be removed.

Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Christian Loehle and committed by
Tejun Heo
5c48d88f 20b15809

+10
+9
kernel/sched/ext.c
··· 6351 6351 */ 6352 6352 __bpf_kfunc struct rq *scx_bpf_cpu_rq(s32 cpu) 6353 6353 { 6354 + struct scx_sched *sch = scx_root; 6355 + 6354 6356 if (!kf_cpu_valid(cpu, NULL)) 6355 6357 return NULL; 6358 + 6359 + if (!sch->warned_deprecated_rq) { 6360 + printk_deferred(KERN_WARNING "sched_ext: %s() is deprecated; " 6361 + "use scx_bpf_locked_rq() when holding rq lock " 6362 + "or scx_bpf_cpu_curr() to read remote curr safely.\n", __func__); 6363 + sch->warned_deprecated_rq = true; 6364 + } 6356 6365 6357 6366 return cpu_rq(cpu); 6358 6367 }
+1
kernel/sched/ext_internal.h
··· 872 872 struct scx_sched_pcpu __percpu *pcpu; 873 873 874 874 bool warned_zero_slice; 875 + bool warned_deprecated_rq; 875 876 876 877 atomic_t exit_kind; 877 878 struct scx_exit_info *exit_info;