]> git.ipfire.org Git - thirdparty/linux.git/commit
sched_ext: Convert ops.set_cmask() to arena-resident cmask
authorTejun Heo <tj@kernel.org>
Fri, 22 May 2026 17:06:01 +0000 (07:06 -1000)
committerTejun Heo <tj@kernel.org>
Mon, 25 May 2026 19:44:07 +0000 (09:44 -1000)
commitabdc2516f100d8f9e637a49e4fdfd2d09a318680
tree65641f72ea7535bdabddb600bdea3b8fee8d7a79
parent9eca087deb0b35f3170109a9630a6c5c06c2e222
sched_ext: Convert ops.set_cmask() to arena-resident cmask

ops_cid.set_cmask() expects a cmask. The kernel couldn't write into the
arena, so it translated cpumask -> cmask in kernel memory and passed the
result as a trusted pointer. The BPF cmask helpers all operate on arena
cmasks though, so the BPF side had to word-by-word probe-read the kernel
cmask into an arena cmask via cmask_copy_from_kernel() before any helper
could touch it. It works, but is clumsy.

With direct kernel-side arena access now in place, build the cmask in the
arena. The kernel writes to it through the kern_va side of the dual mapping.
BPF directly dereferences it via an __arena pointer like any other arena
struct.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
kernel/sched/ext.c
kernel/sched/ext_cid.c
kernel/sched/ext_internal.h
tools/sched_ext/include/scx/cid.bpf.h
tools/sched_ext/scx_qmap.bpf.c