From 76a437f096fb95f4a22edeced382931490319fe4 Mon Sep 17 00:00:00 2001 From: Robert Karl Date: Sun, 11 Oct 2026 11:20:16 -0700 Subject: [PATCH] --ram-cap: clamp only an explicit resident budget With --ram-cap and the automatic --resident-experts the line set resident_budget = cap, which flipped pin_cache_complement into explicit-budget mode (lending off, the file tier unbuffered, the budget warning on every run; review finding 3). The automatic path is bounded by set_host_ram_cap's clamp of host_available_memory already; only a budget the user gave above the cap is lowered to it. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr --- src/program/generate.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/program/generate.cpp b/src/program/generate.cpp index 87581e5..337befb 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -2160,7 +2160,10 @@ int main(int argc, char** argv) { if (o.ram_cap_gib > 0.0) { const uint64_t cap = (uint64_t) (o.ram_cap_gib * 1073741824.0); strata::core::detail::set_host_ram_cap(cap); - if (o.resident_budget == 0 || o.resident_budget > cap) o.resident_budget = o.resident_cpu_experts ? cap : o.resident_budget; + // only an explicit --resident-budget-gib above the cap is clamped: setting a budget for the auto path would + // flip pin_cache_complement into explicit-budget mode (no lending, the file tier unbuffered, the budget + // warning on every run); the auto path is already bounded by the host_available_memory clamp above + if (o.resident_budget > cap) o.resident_budget = cap; std::fprintf(stderr, "strata generate: --ram-cap %.2f GiB: the RAM expert tier and the pinned arena are bounded " "to it (the page cache is not: cap it with the machine or a cgroup)\n", o.ram_cap_gib); }