The expert arena checks the host RAM before it is allocated; the RAM probe reads cgroup v1 too (#633)

The pinned expert arena (the default tier) was allocated without looking at the RAM: on Linux the anonymous mapping
succeeds whatever the host has, and a container whose memory limit is below the arena was killed by the OOM killer
part-way through the load, without a message.

- detail::host_available_memory: the file tier's probe (MemAvailable lowered to the tightest cgroup v2 limit's room),
  now with its files as parameters (tested on fake trees), cgroup v1's memory controller (memory.limit_in_bytes -
  memory.usage_in_bytes), and no cgroup line at all meaning MemAvailable alone (it was "cannot determine", which
  refused a --resident-budget-gib on a v1 host). It also returns the tightest hard limit itself.
- ArenaExpertSource::open, after the size check and before the allocation: a hard cgroup limit below the arena is
  refused with both numbers (a certain OOM kill); less RAM available than the arena is a warning with the numbers
  and what runs with less (--mmap-experts with --resident-budget-gib), and the load goes on. Not for a shared arena.
- file_expert_source_test: v2 limit / max / malformed / missing, v1 limit / unlimited / not mounted, no cgroup.
This commit is contained in:
Niko1221 committed 2026-10-03 18:24:31 +02:00
1 parent 935ac87a54
commit 16a6d77ed4
4 files changed
+166 -16

No files matched your search

+2
View File
@@ -2893,6 +2893,8 @@ int main(int argc, char** argv) {
std::fprintf(stderr, "strata generate: %s\n", err.c_str());
return 1;
}
if (!arena_src.ram_warning().empty()) // #633: said before the load's numbers, which it explains
std::fprintf(stderr, "strata generate: WARNING: %s\n", arena_src.ram_warning().c_str());
std::fprintf(stderr, "strata generate: expert arena: %s\n", arena_src.note().c_str());
std::fprintf(stderr, "strata generate: loaded %.2f GiB at %.2f GiB/s\n",
(double) strata::kernels::cpu::expert_layout().total / (1024.0 * 1024 * 1024),