]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools/sched_ext: scx_qmap: Fix qa arena placement
authorCheng-Yang Chou <yphbchou0911@gmail.com>
Wed, 13 May 2026 08:17:11 +0000 (16:17 +0800)
committerTejun Heo <tj@kernel.org>
Wed, 13 May 2026 18:58:37 +0000 (08:58 -1000)
__arena is a pointer qualifier meaning "this pointer points to arena
memory". When used on a global variable declaration, it expands to
nothing in scx's build because __BPF_FEATURE_ADDR_SPACE_CAST is never
defined, leaving qa as a plain global in BSS. bpftool then generates
skel->bss->qa instead of the expected skel->arena->qa, causing:

  scx_qmap.c: error: 'struct scx_qmap' has no member named 'arena'

__arena_global is the correct annotation for global variables that
reside in the arena. When __BPF_FEATURE_ADDR_SPACE_CAST is not defined
it expands to SEC(".addr_space.1"), placing qa in the arena ELF section.
When __BPF_FEATURE_ADDR_SPACE_CAST is defined it expands to
__attribute__((address_space(1))). In both cases bpftool generates the
typed skel->arena accessor.

Fixes: 60a59eaca71b ("sched_ext: scx_qmap: move globals and cpu_ctx into a BPF arena map")
Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
tools/sched_ext/scx_qmap.bpf.c

index bea43d2359083920450baa4139b4ed9e711334c3..7e77f22674eaa1ece3ca27b20252325139c6009a 100644 (file)
@@ -89,7 +89,7 @@ struct {
 #endif
 } arena SEC(".maps");
 
-struct qmap_arena __arena qa;
+struct qmap_arena __arena_global qa;
 
 /*
  * Global idle-cid tracking, maintained via update_idle / cpu_offline and