mirror of
https://github.com/mailscope/kumomta.git
synced 2026-08-18 18:38:18 +00:00
c17c123402
When running under a cgroup limit, get_cgroup() reported stat.usage_in_bytes (memory.current on v2, memory.usage_in_bytes on v1) as the process memory usage. That counter includes all page cache, including cold reclaimable cache (inactive_file). For a workload that writes logs and spool to disk, cold cache can dominate: on a real pod memory.current was ~51GB while inactive_file was ~46GB and the true non-cache footprint was ~1.8GB. kumod saw usage near its limit, hit get_headroom() == 0, and ran shrink_ready_queue_due_to_low_mem and other reductions against pressure that was almost entirely reclaimable cache the kernel would drop before any OOM. Report the working set instead: ``` working_set = max(memory.current - inactive_file, anon) ``` This matches container_memory_working_set_bytes (kubelet/cAdvisor) and the kernel's own reclaimability accounting. It still counts everything that can drive an OOM: anonymous memory, dirty page cache, active_file, tmpfs/shm, and slab. Signed-off-by: Daniel Schaaff <daniel@danielschaaff.com> closes: https://github.com/KumoCorp/kumomta/pull/549