[GH-ISSUE #5317] [Engine] The expert arena's RAM check ignores a reserved hugetlb pool and falls back to --mmap-experts (0.2.10+) #3170

Open
opened 2026-11-07 14:38:38 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @erikash on GitHub (Nov 5, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5317

Since 0.2.10 (the #4846 change), the engine compares the expert arena's size with MemAvailable before loading it. The arena is mapped with MAP_HUGETLB when a pool is reserved, but pages reserved in vm.nr_hugepages don't count in MemAvailable. So on a host that reserved a pool exactly for the arena, the check always finds the RAM "short". The engine then falls back to the file source plus a RAM copy. The pool sits unused, and the RAM copy takes what's left of the host's memory.

Setup: ghcr.io/niko1221/strata:0.2.11-cuda13 (engine 0.1.57), Linux in Docker, one RTX 3090, a 157 GiB VM, FAMILY=unsloth MODEL=UD-Q5_K_XL (arena 91.62 GiB). Before the start, vm.nr_hugepages=47450 (2 MB pages, 92.7 GiB), and HugePages_Free is 47450.

What happens (strata.engine.log):

strata generate: the expert arena needs 91.62 GiB of RAM and 53.00 GiB is available; waiting up to 20 s for it (another engine still exiting?) - 15 s so far
strata generate: not enough RAM for the expert arena (it needs 91.62 GiB and 53.04 GiB is available (38.58 GiB short, after waiting)): this run reads the experts from the file, like --mmap-experts
FileExpertSource: RAM budget 48.02 GiB: 12873 of the 77.16 GiB of experts the GPU cache does not hold, by profile rank; the rest are read from the files
strata generate: resident RAM mode: 48.02 GiB of experts in RAM (page-locked), 3880 in the GPU cache
strata serve: file tier I/O this request: the OS read 123194.6 MB from storage (1941 major faults) for 17639.6 MB of expert reads

Afterwards, HugePages_Free is still 47450 (the pool was never touched), and free -g shows 0 GiB available on the host. The experts come from a SATA drive (0.45 GB/s in the prefill plan).

With STRATA_ARENA_RAM_FALLBACK=0 (changing nothing else), it logs the warning and loads the arena into the pool, as on 0.2.9:

strata generate: WARNING: the expert arena needs 91.62 GiB of RAM but 53.27 GiB is available (38.35 GiB short, after waiting): the load may swap or be stopped by the OS
strata generate: expert arena: cudaHostRegister PORTABLE ok; hugetlb 2 MB pages

Now HugePages_Free is 541 and the host has 50 GiB available. Decode is 98-101 / 80-82 / 75-76 tok/s (code / explain / story), and a 19.6K prompt reads at about 2,200 tok/s.

Expected: when the arena will go to hugetlb pages, arena_ram_verdict (include/strata/core/ple_residency.hpp) should count the free pool (HugePages_Free × Hugepagesize) toward what's available, or check that the pool covers the arena. Either way, a reserved pool shouldn't trigger the fallback or the 20 s wait.

Workaround: STRATA_ARENA_RAM_FALLBACK=0. That's fine when the pool is known to cover the arena, but it also turns off the protection #4846 added for hosts that really are short.

Originally created by @erikash on GitHub (Nov 5, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5317 Since 0.2.10 (the #4846 change), the engine compares the expert arena's size with MemAvailable before loading it. The arena is mapped with `MAP_HUGETLB` when a pool is reserved, but pages reserved in `vm.nr_hugepages` don't count in MemAvailable. So on a host that reserved a pool exactly for the arena, the check always finds the RAM "short". The engine then falls back to the file source plus a RAM copy. The pool sits unused, and the RAM copy takes what's left of the host's memory. **Setup:** `ghcr.io/niko1221/strata:0.2.11-cuda13` (engine 0.1.57), Linux in Docker, one RTX 3090, a 157 GiB VM, `FAMILY=unsloth MODEL=UD-Q5_K_XL` (arena 91.62 GiB). Before the start, `vm.nr_hugepages=47450` (2 MB pages, 92.7 GiB), and `HugePages_Free` is 47450. **What happens** (`strata.engine.log`): ``` strata generate: the expert arena needs 91.62 GiB of RAM and 53.00 GiB is available; waiting up to 20 s for it (another engine still exiting?) - 15 s so far strata generate: not enough RAM for the expert arena (it needs 91.62 GiB and 53.04 GiB is available (38.58 GiB short, after waiting)): this run reads the experts from the file, like --mmap-experts FileExpertSource: RAM budget 48.02 GiB: 12873 of the 77.16 GiB of experts the GPU cache does not hold, by profile rank; the rest are read from the files strata generate: resident RAM mode: 48.02 GiB of experts in RAM (page-locked), 3880 in the GPU cache strata serve: file tier I/O this request: the OS read 123194.6 MB from storage (1941 major faults) for 17639.6 MB of expert reads ``` Afterwards, `HugePages_Free` is still 47450 (the pool was never touched), and `free -g` shows 0 GiB available on the host. The experts come from a SATA drive (0.45 GB/s in the prefill plan). **With `STRATA_ARENA_RAM_FALLBACK=0`** (changing nothing else), it logs the warning and loads the arena into the pool, as on 0.2.9: ``` strata generate: WARNING: the expert arena needs 91.62 GiB of RAM but 53.27 GiB is available (38.35 GiB short, after waiting): the load may swap or be stopped by the OS strata generate: expert arena: cudaHostRegister PORTABLE ok; hugetlb 2 MB pages ``` Now `HugePages_Free` is 541 and the host has 50 GiB available. Decode is 98-101 / 80-82 / 75-76 tok/s (code / explain / story), and a 19.6K prompt reads at about 2,200 tok/s. **Expected:** when the arena will go to hugetlb pages, `arena_ram_verdict` (`include/strata/core/ple_residency.hpp`) should count the free pool (`HugePages_Free × Hugepagesize`) toward what's available, or check that the pool covers the arena. Either way, a reserved pool shouldn't trigger the fallback or the 20 s wait. **Workaround:** `STRATA_ARENA_RAM_FALLBACK=0`. That's fine when the pool is known to cover the arena, but it also turns off the protection #4846 added for hosts that really are short.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3170
No description provided.