From 6c5ed0db3a97737fa7fb76ed448f55d9e99424c5 Mon Sep 17 00:00:00 2001 From: Odin Ugedal Date: Mon, 22 Feb 2021 08:44:49 +0100 Subject: [PATCH] Fix memory stats for cache in fs2 In cgroup v2, the "cache" value from cgroup v1 is called "file" in v2. There are no values called "cache" in v2. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/memcontrol.c?id=31caf8b2a847214be856f843e251fc2ed2cd1075#n1521 Signed-off-by: Odin Ugedal --- libcontainer/cgroups/fs2/memory.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcontainer/cgroups/fs2/memory.go b/libcontainer/cgroups/fs2/memory.go index 1c6913bf0f5..81b28df75a5 100644 --- a/libcontainer/cgroups/fs2/memory.go +++ b/libcontainer/cgroups/fs2/memory.go @@ -88,7 +88,7 @@ func statMemory(dirPath string, stats *cgroups.Stats) error { } stats.MemoryStats.Stats[t] = v } - stats.MemoryStats.Cache = stats.MemoryStats.Stats["cache"] + stats.MemoryStats.Cache = stats.MemoryStats.Stats["file"] memoryUsage, err := getMemoryDataV2(dirPath, "") if err != nil {