The memory usage reported in cgroup differs from the free command
Why would the free command be reporting a much different mem usage number vs cgroup?
$ free -b
total used free shared buff/cache available
Mem: 2096914432 520863744 1112170496 35389440 463880192 1356828672
Swap: 2145382400 0 2145382400
$ cat /sys/fs/cgroup/memory/memory.usage_in_bytes
857239552
The documentation for cgroups says that memory.usage_in_bytes is a "fuzz value". I'm guessing that just means it reports an estimate that's close to the actual value. Even if it's an estimate, I don't think it should be this far off.
I'm running Linux Mint 18.2 in a VirutalBox VM.
memory.usage_in_bytes
and memory.max_usage_in_bytes
report RSS+CACHE, so in terms of your free
output:
memory.usage_in_bytes ~= free.used + free.(buff/cache) - (buff)
You may also be interested in /sys/fs/cgroup/memory/memory.stat
, though I still couldn't find/compute the free.used
value from the /sys/fs/cgroup/memory/memory.stat
output.