From 6fa48d904862dd96234a63bb65585c4d34dc670a Mon Sep 17 00:00:00 2001 From: Derek Carr Date: Tue, 22 Aug 2017 23:38:23 -0400 Subject: [PATCH] Expose total_rss when hierarchy is enabled --- container/libcontainer/helpers.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/container/libcontainer/helpers.go b/container/libcontainer/helpers.go index a703504866..da25bf074a 100644 --- a/container/libcontainer/helpers.go +++ b/container/libcontainer/helpers.go @@ -466,8 +466,14 @@ func setMemoryStats(s *cgroups.Stats, ret *info.ContainerStats) { ret.Memory.Usage = s.MemoryStats.Usage.Usage ret.Memory.Failcnt = s.MemoryStats.Usage.Failcnt ret.Memory.Cache = s.MemoryStats.Stats["cache"] - ret.Memory.RSS = s.MemoryStats.Stats["rss"] - ret.Memory.Swap = s.MemoryStats.Stats["swap"] + + if s.MemoryStats.UseHierarchy { + ret.Memory.RSS = s.MemoryStats.Stats["total_rss"] + ret.Memory.Swap = s.MemoryStats.Stats["total_swap"] + } else { + ret.Memory.RSS = s.MemoryStats.Stats["rss"] + ret.Memory.Swap = s.MemoryStats.Stats["swap"] + } if v, ok := s.MemoryStats.Stats["pgfault"]; ok { ret.Memory.ContainerData.Pgfault = v ret.Memory.HierarchicalData.Pgfault = v