From d7f16a57da09f39eabf0c39e85ed6a46235af6f6 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 a7035048660..da25bf074a8 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