From b09b68c4a961ea33ee74cfa1f479ee335efb3a42 Mon Sep 17 00:00:00 2001 From: Valentyn Boginskey Date: Sat, 28 Jul 2018 07:20:42 -0400 Subject: [PATCH] Fix cache reporting with cgroup hierarchy --- container/libcontainer/handler.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/container/libcontainer/handler.go b/container/libcontainer/handler.go index 9a8956c3..e4a0924a 100644 --- a/container/libcontainer/handler.go +++ b/container/libcontainer/handler.go @@ -498,12 +498,13 @@ func setMemoryStats(s *cgroups.Stats, ret *info.ContainerStats) { ret.Memory.Usage = s.MemoryStats.Usage.Usage ret.Memory.MaxUsage = s.MemoryStats.Usage.MaxUsage ret.Memory.Failcnt = s.MemoryStats.Usage.Failcnt - ret.Memory.Cache = s.MemoryStats.Stats["cache"] if s.MemoryStats.UseHierarchy { + ret.Memory.Cache = s.MemoryStats.Stats["total_cache"] ret.Memory.RSS = s.MemoryStats.Stats["total_rss"] ret.Memory.Swap = s.MemoryStats.Stats["total_swap"] } else { + ret.Memory.Cache = s.MemoryStats.Stats["cache"] ret.Memory.RSS = s.MemoryStats.Stats["rss"] ret.Memory.Swap = s.MemoryStats.Stats["swap"] }