From c2957b221264d7f0caba4137fd6a39b611abd9c8 Mon Sep 17 00:00:00 2001 From: Siarhei Rasiukevich Date: Sun, 5 Jan 2025 18:19:27 +0200 Subject: [PATCH] exclude cgroups slab_reclaimable from container_memory_working_set_bytes --- container/libcontainer/handler.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/container/libcontainer/handler.go b/container/libcontainer/handler.go index 9f05a52a49..da636c2a55 100644 --- a/container/libcontainer/handler.go +++ b/container/libcontainer/handler.go @@ -848,6 +848,12 @@ func setMemoryStats(s *cgroups.Stats, ret *info.ContainerStats) { workingSet -= v } } + + // Exclude "slab_reclaimable" from workingSet + if v, ok := s.MemoryStats.Stats["slab_reclaimable"]; ok { + workingSet -= v + } + ret.Memory.WorkingSet = workingSet }