Skip to content

fix(strata): check remaining cgroup memory before loading the expert arena - #308

Merged
linyubupa merged 1 commit into
Edge0-AI:mainfrom
agourakis82:fix/strata-arena-cgroup-headroom
Nov 19, 2026
Merged

linyubupa merged 1 commit into
Edge0-AI:mainfrom
agourakis82:fix/strata-arena-cgroup-headroom

Conversation

@agourakis82

@agourakis82 agourakis82 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What & why

The expert arena can fit below a cgroup's total limit while exceeding its remaining capacity. Check remaining capacity after the existing wait and resample, and exclude tmpfs and shared memory from the disk cache credit. Warn when the arena fits with little room left for serving. The 120B guide shows how to set a lower resident expert budget.

Related to #301.

Area

  • Other (edge0-strata, expert arena admission)
  • 120B guide (edge0-infer/docs/edge0-120b.md)

How was it tested?

Linux, RTX 4000 Ada, official Edge0-120B-q3k at ad5ea45a67ab6cd6761c364793bebb363a69720c, native serving protocol, cgroup v2 with swap disabled. This standalone build used 3b056d5 with the arena patch.

With a 29 GiB limit and a real 5 GiB shared anonymous mapping in the same cgroup, an earlier candidate credited the shared memory as file cache and was OOM-killed. The submitted candidate refused before allocation with 26.66 GiB required and 22.93 GiB available, with zero OOM kills. Under the same pressure, the 16 GiB resident expert budget completed all three requests. The full arena also completed all three at 29 GiB without the extra mapping and refused the 27 GiB case before allocation.

ctest -R '^(arena_memory_test|memory_guard_test|file_expert_source_test)$' --output-on-failure passed all three suites on Linux. Fixtures cover shared memory alone, mixed disk cache, missing and racy counters, and the production cgroup parser. The 2.5 GiB advisory does not estimate peak serving memory. The reporter's HTTP benchmark was outside this validation.

Windows x64, 675054f8. A separate GitHub Actions job built and linked strata.exe in Release with Visual Studio 2022, MSVC 19.44, CUDA Toolkit 13.0.3 and sm_89. All 16 arena memory checks passed with clang-cl in C++23. Windows GPU execution and Windows Arm64 were outside this run.

macOS arm64, 675054f8. The stock Strata Metal build linked and strata --help exited successfully. runtime_hello passed on an M5 Max. The arena memory test passed all 16 checks in C++23 Release and with ASan/UBSan. Model serving on Metal was outside this run.

Checklist

  • Added or updated tests for new behavior
  • Ran the affected Linux/CUDA tests and the 120B workload
  • Updated the 120B guide

Local pre-submit checks on the current Edge0 base passed all 15 L0 checks and the three targeted L1 tests for platform, platform memory and execution budget. The full Edge0 CPU build with a C++23 override failed in the unchanged CLI source (serve_protocol.cpp, string/JSON equality); the stock Edge0 preset uses C++17. The GPU tests above exercised the Strata binaries separately.

@agourakis82
agourakis82 marked this pull request as ready for review November 19, 2026 09:58
@github-actions github-actions Bot added strata edge0-strata docs Documentation labels Nov 19, 2026
@linyubupa
linyubupa merged commit d5689d9 into Edge0-AI:main Nov 19, 2026
9 checks passed
philmcneely pushed a commit to philmcneely/Edge0 that referenced this pull request Nov 19, 2026
…rving headroom

Edge0-AI#301: a container whose memory.max holds the expert arena but nothing else loads it, serves
for a while and is then OOM-killed mid-conversation, because the kernel stops the group
instead of reclaiming its pages. Edge0-AI#308 catches this only when the remaining capacity is below
the arena itself; the case that was reported - 29 GiB limit, 26.66 GiB arena, 2.50 GiB of
recommended serving headroom missing - still started and still died.

The headroom is now a refusal when a cgroup limit is in force, with the numbers and three ways
out (a smaller arena, a higher limit, or STRATA_ARENA_HEADROOM_MIB=0 for a caller that never
opens a conversation). A bare host keeps the warning: its pages can be reclaimed, so there the
recommend-not-force rule still holds. The bare-host message now reports the effective headroom,
which STRATA_ARENA_HEADROOM_MIB can change.

Verified on the FC500T box in a user cgroup: 145B NVFP4 under MemoryMax=48G refuses with
"needs 44.30 GiB ... leaves 45.06 GiB: that is 1.74 GiB short of the recommended 2.50 GiB";
120B NVFP4 under 35G refuses likewise; a limit below the arena still takes the Edge0-AI#308 message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation strata edge0-strata

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants