Skip to content

Restore the __arena tags and drop the SCX_ARENA_SCALAR build switch - #3955

Open
htejun wants to merge 3 commits into
mainfrom
htejun/arena-tags
Open

htejun wants to merge 3 commits into
mainfrom
htejun/arena-tags

Conversation

@htejun

@htejun htejun commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

The kernel's BPF_F_ARENA_SCALAR load flag was removed in the v7.4 merge
window, before any release had it. scx_mavd and scx_nitosis load only with
the flag, so neither loads on any released kernel. Restore the __arena tags
in both, the code written untagged since the drop included, and drop the
SCX_ARENA_SCALAR build switch. The untagged form is expected back in a
different, LLVM-based shape, so nothing of the switch is kept.

  • scx_mavd: Restore the __arena tags
  • scx_nitosis: Restore the __arena tags
  • scheds/include, scx_utils: Drop the SCX_ARENA_SCALAR build switch

scx_mavd is built with SCX_ARENA_SCALAR and loads only with the kernel's
BPF_F_ARENA_SCALAR flag. b62dee3a8bb5 ("bpf: Remove BPF_F_ARENA_SCALAR")
removed the flag in the v7.4 merge window, before any release had it, so the
object can't load on any released kernel.

Revert 6b9fe0d ("scx_mavd: Drop the __arena tags") and tag the arena
code added after it, written without tags under SCX_ARENA_SCALAR. Every
pointer to an arena struct carries __arena again, __arg_arena parameters
included.

In CONVERSION.md:

- The passages that 39a862f ("scx_mavd: Sync with lavd through
  82ba421") rewrote for SCX_ARENA_SCALAR go back to their earlier
  wording.
- The stack-model numbers are re-taken on the tagged object. The verifier's
  own counts and depths are still from the SCX_ARENA_SCALAR object and are
  marked as such.
- The note that veristat no longer loads the object goes. veristat verifies
  every program of the tagged object on a 7.4 kernel.
scx_nitosis is built with SCX_ARENA_SCALAR and loads only with the kernel's
BPF_F_ARENA_SCALAR flag. b62dee3a8bb5 ("bpf: Remove BPF_F_ARENA_SCALAR")
removed the flag in the v7.4 merge window, before any release had it, so the
object can't load on any released kernel.

Revert 53c6c02 ("scx_nitosis: Drop the __arena tags") and tag the arena
pointers that 0b21252 ("scx_nitosis: Factor update_cid_idle() out of
ops.update_idle()") and 986efff ("scx_nitosis: Charge running time when
dispatch extends a solo task's slice") added without tags. Every pointer to
an arena struct carries __arena again.

The CONVERSION.md passages that 849ad5b ("scx_nitosis: Record the sync
with mitosis through ba5f4dc") rewrote for SCX_ARENA_SCALAR go back to
their earlier wording, and the stack-model numbers are re-taken on the
tagged object, with the verifier's own counts marked as still from the
SCX_ARENA_SCALAR object.
Under SCX_ARENA_SCALAR an object is built without the __arena tags and loads
only with the kernel's BPF_F_ARENA_SCALAR flag. b62dee3a8bb5 ("bpf: Remove
BPF_F_ARENA_SCALAR") removed the flag in the v7.4 merge window, before any
release had it, so such an object can't load on any released kernel.
scx_mavd and scx_nitosis, the only users of the switch, build with the
__arena tags again.

Revert 4df93d9 ("scheds/include, scx_utils: Add the SCX_ARENA_SCALAR
build switch"). The untagged form is expected back through an LLVM pass that
emits the address-space cast for each pointer, which needs nothing from the
switch, so none of it is kept. scheds/include/bpf_arena_common.bpf.h is
again identical to mainline's
tools/sched_ext/include/scx/bpf_arena_common.bpf.h.
@htejun
htejun requested a review from kkdwvd October 29, 2026 23:42
struct cpu_ctx *cpuc_cur = get_cpu_ctx();
struct cpu_ctx *cpuc;
struct cpu_ctx __arena *cpuc_cur = get_cpu_ctx();
struct cpu_ctx __arena *cpuc;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flagged by AI:

Restoring the annotations increases the modeled lavd_enqueue() call chain to 528 bytes. Although mavd requires v7.4, the larger 2 KiB stack budget in BPF only applies to x86-64 and arm64 JITs; other architectures retain 512 bytes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ok, a lot of BPF features depended upon by new schedulers are only supported for x86 and arm64.

@arighi arighi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @kkdwvd pointed out, the stack increase seems acceptable given the schedulers’ architecture requirements. So, looks good to me after a rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants