Skip to content

Commit

Permalink
Fix memory stats for cache in fs2
Browse files Browse the repository at this point in the history
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
  • Loading branch information
odinuge committed Feb 22, 2021
1 parent f245a1d commit 3af80bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libcontainer/cgroups/fs2/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3af80bd

Please # to comment.