Memory

We can see from this experiment that container_memory_usage_bytes does account for some filesystem pages that are being cached. We can also see that OOMKiller is tracking container_memory_working_set_bytes. This makes sense as shared filesystem cache pages can be evicted from memory at any time. There’s no point in killing the process just for using disk I/O.

The OOMKiller is mostly tracking container_memory_working_set_bytes, which is

Precisely, container_memory_working_set_bytes = container_memory_usage_bytes - inactive_file (from cadvisor code) = rss + cache + swap - inactive_file (from section 5.5 https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt) = rss + active_cache + swap = rss + active_cache (swap is disabled in k8s)

Note that unreclaimable page cache is also accounted for.

References