compat.bpf.h: Add override for scx_bpf_dsq_peek version gate#3585
compat.bpf.h: Add override for scx_bpf_dsq_peek version gate#3585bboymimi wants to merge 1 commit into
Conversation
a3f2784 ("compat.bpf.h: Gate scx_bpf_dsq_peek kfunc behind kernel version 7.1.0") gates the lockless peek kfunc by LINUX_KERNEL_VERSION, but the version check misses stable backports. A kernel that has both upstream FIFO fixes 71d7847cad44 ("sched_ext: Fix scx_bpf_dsq_peek() with FIFO DSQs") 2f2ea7709266 ("sched_ext: Use dsq->first_task instead of list_empty() in dispatch_enqueue() FIFO-tail") cherry-picked but still reporting < 7.1.0 ends up on the iterator fallback. CachyOS users on 6.18.31 reported a 4x FPS drop in Cyberpunk 2077. Add __COMPAT_scx_allow_lockless_peek_unsafe as a __weak rodata bool. When true, bpf_ksym_exists() alone is enough to take the fast path. Expose it in scx_lavd as --allow-lockless-peek-unsafe. Default false, so kernels without the fixes stay on the iterator path. Only enable on kernels that have both fixes backported. Signed-off-by: Gavin Guo <gavinguo@igalia.com>
|
I'm not too convinced that using non-peek can cause this level of regression or else we'd have very poor performance for older kernels and/or older LAVD versions. Do we understand what causes the perf drop and can we replicate the regression in other microbenchmarks? |
|
Let's wait until we collect more evidence of the performance regression. |
|
Thanks a lot for the patch which I've just tested with the latest scx-scheds-git main branch on Kernel 6.18.32 in these two scenarios: Scenario A: LAVD without Possibly related dmesg output: Scenario B: LAVD with |
What's the hardware you are using? It sounds like a pretty beefy machine with many CPUs? |
@multics69 As mentioned in #3580 (comment), I use an Intel 14700KF (Raptor Lake) with a Z690 motherboard, 64 GB DDR4-3600, AMD Vega 64. The CPU comes with 8 P-Cores and 12 E-Cores. |
a3f2784 ("compat.bpf.h: Gate scx_bpf_dsq_peek kfunc behind kernel
version 7.1.0") gates the lockless peek kfunc by LINUX_KERNEL_VERSION,
but the version check misses stable backports. A kernel that has both
upstream FIFO fixes
71d7847cad44 ("sched_ext: Fix scx_bpf_dsq_peek() with FIFO DSQs")
2f2ea7709266 ("sched_ext: Use dsq->first_task instead of list_empty()
in dispatch_enqueue() FIFO-tail")
cherry-picked but still reporting < 7.1.0 ends up on the iterator
fallback. CachyOS users on 6.18.31 reported a 4x FPS drop in Cyberpunk
2077.
Add __COMPAT_scx_allow_lockless_peek_unsafe as a __weak rodata bool.
When true, bpf_ksym_exists() alone is enough to take the fast path.
Expose it in scx_lavd as --allow-lockless-peek-unsafe. Default false,
so kernels without the fixes stay on the iterator path. Only enable
on kernels that have both fixes backported.