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/tools: Add compat wrapper for scx_bpf_task_set_slice/dsq_vtime()

for sub-scheduler authority checks. Add compat wrappers which fall back to
direct p->scx field writes on older kernels.

Suggested-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

Tejun Heo bd7143e7 cded46d9

+24 -2
-2
tools/sched_ext/include/scx/common.bpf.h
··· 101 101 s32 scx_bpf_pick_any_cpu(const cpumask_t *cpus_allowed, u64 flags) __ksym; 102 102 bool scx_bpf_task_running(const struct task_struct *p) __ksym; 103 103 s32 scx_bpf_task_cpu(const struct task_struct *p) __ksym; 104 - bool scx_bpf_task_set_slice(struct task_struct *p, u64 slice) __ksym __weak; 105 - bool scx_bpf_task_set_dsq_vtime(struct task_struct *p, u64 vtime) __ksym __weak; 106 104 struct rq *scx_bpf_cpu_rq(s32 cpu) __ksym; 107 105 struct rq *scx_bpf_locked_rq(void) __ksym; 108 106 struct task_struct *scx_bpf_cpu_curr(s32 cpu) __ksym __weak;
+24
tools/sched_ext/include/scx/compat.bpf.h
··· 235 235 } 236 236 237 237 /* 238 + * v6.19: scx_bpf_task_set_slice() and scx_bpf_task_set_dsq_vtime() added to for 239 + * sub-sched authority checks. Drop the wrappers and move the decls to 240 + * common.bpf.h after v6.22. 241 + */ 242 + bool scx_bpf_task_set_slice___new(struct task_struct *p, u64 slice) __ksym __weak; 243 + bool scx_bpf_task_set_dsq_vtime___new(struct task_struct *p, u64 vtime) __ksym __weak; 244 + 245 + static inline void scx_bpf_task_set_slice(struct task_struct *p, u64 slice) 246 + { 247 + if (bpf_ksym_exists(scx_bpf_task_set_slice___new)) 248 + scx_bpf_task_set_slice___new(p, slice); 249 + else 250 + p->scx.slice = slice; 251 + } 252 + 253 + static inline void scx_bpf_task_set_dsq_vtime(struct task_struct *p, u64 vtime) 254 + { 255 + if (bpf_ksym_exists(scx_bpf_task_set_dsq_vtime___new)) 256 + scx_bpf_task_set_dsq_vtime___new(p, vtime); 257 + else 258 + p->scx.dsq_vtime = vtime; 259 + } 260 + 261 + /* 238 262 * Define sched_ext_ops. This may be expanded to define multiple variants for 239 263 * backward compatibility. See compat.h::SCX_OPS_LOAD/ATTACH(). 240 264 */