Open linxiulei opened 1 year ago
I think this maybe make sense.
For now, we use /proc/meminfo
to calculate the swap info, and memory.stat
to calculate the usage info. I think this may be strange. Perhaps we should calculate the memory info for the same place
cc @lifubang
ping @lifubang @AkihiroSuda (
@linxiulei @Zheaoli we have changed this code a few times already to please k8s. Feel free to open a PR.
Description
From the comments in https://github.com/opencontainers/runc/blob/main/libcontainer/cgroups/fs2/memory.go#L218, it appears the root stats of cgroup v2 was collected in a way to be similar to how v1 is implemented. My understanding, root stats v2 should be collected as memory.current in non-root cgroups, which is supposed to be total memory as opposed to just anon + file.
This issue causes missing a visible amount memory not counted in Usage (e.g. kernel memory) and is misleading. I propose using the value from /proc/meminfo to get the total memory usage for root stat.
Steps to reproduce the issue
Describe the results you received and expected
root stats'
usageBytes
should match system memory usageWhat version of runc are you using?
runc version 1.1.7 commit: a916309fff0f838eb94e928713dbc3c0d0ac7aa4 spec: 1.0.2-dev go: go1.20.5 libseccomp: 2.5.4
Host OS information
No response
Host kernel information
No response