[PR #5341] [Engine] credit a reserved huge-page pool when the expert arena weighs the RAM (#5317) #5394

Open
opened 2026-11-07 16:34:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/5341
Author: @qdotme
Created: 11/5/2026
Status: 🔄 Open

Base: main ← Head: f-055-arena-hugetlb


📝 Commits (1)

  • 41ec883 arena: a reserved huge-page pool counts as the RAM the expert arena needs (#5317): the #4846 fallback weighed the arena against MemAvailable alone, so a host that reserved vm.nr_hugepages for it read as short on every start and took the file source while the pool sat unused (seen on a 125 GiB box with a 71.73 GiB arena: 123 GB read from storage in one request); the Linux probe now reads HugePages_Free x Hugepagesize, and a pool of the arena's size loads with a line naming the pool; the wait, the give-back and the fallback keep their rules when RAM and pool are both short, and a hard cgroup limit still governs. Tests: ple_residency_test 909 checks and file_expert_source_test pass; one engine built and run on Linux CUDA, HIP/SYCL not built here.

📊 Changes

5 files changed (+69 additions, -29 deletions)

View changed files

📝 include/strata/core/expert_source.hpp (+3 -1)
📝 include/strata/core/ple_residency.hpp (+11 -7)
📝 src/core/expert_source.cpp (+34 -10)
📝 src/core/ple_residency_test.cpp (+15 -11)
📝 tests/core/file_expert_source_test.cpp (+6 -0)

📄 Description

Problem and result

Problem (observed, reproduced locally): since #4846 the arena is priced against MemAvailable only. Reserved vm.nr_hugepages pages are not in MemAvailable, so a host that reserved a pool exactly for the arena reads short on every start and takes the --mmap-experts file source while the pool sits unused. On this host (engine 0.1.56, Linux, 2x RTX 4090, 125 GiB RAM, nr_hugepages=36727, arena 71.73 GiB): not enough RAM for the expert arena (30.47 GiB short) → experts via mmap → 123–400 GB read from storage per request, VSZ 209 GiB, swap touched. Matches #5317's Docker report exactly.

Result after the change: the reserved huge-page pool has 71.73 GiB free (vm.nr_hugepages), so the arena loads on 2 MB pages → cudaHostRegister PORTABLE ok; hugetlb 2 MB pages; HugePages_Free: 0, Private_Hugetlb: 71.7 GiB, VSZ 138 GiB, no workaround env, one completion verified end to end.

None

Approach

Approach: the Linux probe reads HugePages_Free × Hugepagesize beside MemAvailable; arena_ram_verdict loads when either alone covers the arena (MAP_HUGETLB is all-or-nothing at exactly the arena size, so a pool of the arena's size is the RAM). Pool short → wait, give-back and fallback are byte-identical to today. A hard cgroup limit still governs regardless of the pool.

Validation

Passed:
Validation — passed: ple_residency_test 909 checks (4 new pool checks incl. "cgroup limit beats the pool"); file_expert_source_test (3 new HugePages parse checks — one caught a parser bug in the first draft); engine 0.1.57 built at this rebase and run on the box above, before/after A/B as quoted.

Not run:
Validation — not run: HIP and SYCL builds (no toolchains here), a cgroup-limited container with a pool, Windows/macOS (field reads 0 by construction).

Limits

Default 2 MB page size only (a foreign Hugepagesize would need a MAP_HUGE_* flag the arena does not request); Linux reader, like the rest of the guard.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/5341 **Author:** [@qdotme](https://github.com/qdotme) **Created:** 11/5/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `f-055-arena-hugetlb` --- ### 📝 Commits (1) - [`41ec883`](https://github.com/Niko1221/Strata/commit/41ec883fdfbd7f7bf09b2c7158faff5074c038fa) arena: a reserved huge-page pool counts as the RAM the expert arena needs (#5317): the #4846 fallback weighed the arena against MemAvailable alone, so a host that reserved vm.nr_hugepages for it read as short on every start and took the file source while the pool sat unused (seen on a 125 GiB box with a 71.73 GiB arena: 123 GB read from storage in one request); the Linux probe now reads HugePages_Free x Hugepagesize, and a pool of the arena's size loads with a line naming the pool; the wait, the give-back and the fallback keep their rules when RAM and pool are both short, and a hard cgroup limit still governs. Tests: ple_residency_test 909 checks and file_expert_source_test pass; one engine built and run on Linux CUDA, HIP/SYCL not built here. ### 📊 Changes **5 files changed** (+69 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/core/expert_source.hpp` (+3 -1) 📝 `include/strata/core/ple_residency.hpp` (+11 -7) 📝 `src/core/expert_source.cpp` (+34 -10) 📝 `src/core/ple_residency_test.cpp` (+15 -11) 📝 `tests/core/file_expert_source_test.cpp` (+6 -0) </details> ### 📄 Description ## Problem and result Problem (observed, reproduced locally): since #4846 the arena is priced against MemAvailable only. Reserved `vm.nr_hugepages` pages are not in MemAvailable, so a host that reserved a pool exactly for the arena reads short on every start and takes the `--mmap-experts` file source while the pool sits unused. On this host (engine 0.1.56, Linux, 2x RTX 4090, 125 GiB RAM, nr_hugepages=36727, arena 71.73 GiB): not enough RAM for the expert arena (30.47 GiB short) → experts via mmap → 123–400 GB read from storage per request, VSZ 209 GiB, swap touched. Matches #5317's Docker report exactly. Result after the change: the reserved huge-page pool has 71.73 GiB free (vm.nr_hugepages), so the arena loads on 2 MB pages → cudaHostRegister PORTABLE ok; hugetlb 2 MB pages; HugePages_Free: 0, Private_Hugetlb: 71.7 GiB, VSZ 138 GiB, no workaround env, one completion verified end to end. ## Related discussion None ## Approach Approach: the Linux probe reads HugePages_Free × Hugepagesize beside MemAvailable; arena_ram_verdict loads when either alone covers the arena (MAP_HUGETLB is all-or-nothing at exactly the arena size, so a pool of the arena's size is the RAM). Pool short → wait, give-back and fallback are byte-identical to today. A hard cgroup limit still governs regardless of the pool. ## Validation **Passed:** Validation — passed: ple_residency_test 909 checks (4 new pool checks incl. "cgroup limit beats the pool"); file_expert_source_test (3 new HugePages parse checks — one caught a parser bug in the first draft); engine 0.1.57 built at this rebase and run on the box above, before/after A/B as quoted. **Not run:** Validation — not run: HIP and SYCL builds (no toolchains here), a cgroup-limited container with a pool, Windows/macOS (field reads 0 by construction). ## Limits Default 2 MB page size only (a foreign Hugepagesize would need a MAP_HUGE_* flag the arena does not request); Linux reader, like the rest of the guard. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#5394
No description provided.