pub fn resolve_mem_budget_mb(
explicit_mb: Option<usize>,
cgroup_bytes: Option<u64>,
physical_bytes: Option<u64>,
) -> usizeExpand description
Resolve the admission memory budget (MB) from the three inputs, in one place the tests exercise so it can never silently regress to 0-when-a-ceiling-is- readable.
Precedence:
- An explicit
IFC_MEM_BUDGET_MBwins outright.Some(0)is honored as a deliberate opt-out (memory gate off) - it is NOT treated as “unset”. - Otherwise, 70% of the tightest readable ceiling:
min(cgroup, physical). Using the tighter of the two keeps a small cgroup from being overridden by a large host, and lets physical RAM bound a bare VM with no cgroup. - Otherwise
0(gate off) - only when neither ceiling is readable (non-Linux dev, or/procunavailable), which the caller logs loudly.