9

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.

1 Answer 1

7

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.

2
  • 1
    What's the difference between free.(buff/cache) and (buff) in this answer? It's not clear where you're getting the (buff) value from. free.used and free.(buff/cache) are clearly from the output of running free. Commented Jul 14, 2021 at 2:06
  • 1
    @davidparks21 as far as I recall, the thing is that you cannot find pure (buff), but memory.usage_in_bytes seems to only include the cache Commented Jul 14, 2021 at 6:45

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.