mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 14:13:58 +08:00
7d2becdf2c
This aligns v2 usage calculations more closely with v1. Current node-level reporting for v1 vs v2 on the same machine under similar load may differ by ~250-750Mi. Also return usage as combined swap + memory usage, aligned with v1 and non-root v2 cgroups. `mem_cgroup_usage` in the kernel counts NR_FILE_PAGES + NR_ANON_MAPPED + `nr_swap_pages` (if swap enabled) [^0]. Using total - free results in higher "usage" numbers. This is likely due to various types of reclaimable memory technically counted as in use (e.g. inactive anon). See also https://github.com/kubernetes/kubernetes/issues/118916 for more context [^0]: https://github.com/torvalds/linux/blob/06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5/mm/memcontrol.c#L3673-L3680 Signed-off-by: Alexander Eldeib <alexeldeib@gmail.com>