Skip to content

Commit eb9ce4d

Browse files
committed
libcontainer: use inactive_file on cgroup v2
total_inactive_file is present only on cgroup v1 Signed-off-by: Giuseppe Scrivano <[email protected]>
1 parent 74bbe23 commit eb9ce4d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

container/libcontainer/handler.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,13 @@ func setMemoryStats(s *cgroups.Stats, ret *info.ContainerStats) {
854854
ret.Memory.HierarchicalData.Pgmajfault = v
855855
}
856856

857+
inactiveFileKeyName := "total_inactive_file"
858+
if cgroups.IsCgroup2UnifiedMode() {
859+
inactiveFileKeyName = "inactive_file"
860+
}
861+
857862
workingSet := ret.Memory.Usage
858-
if v, ok := s.MemoryStats.Stats["total_inactive_file"]; ok {
863+
if v, ok := s.MemoryStats.Stats[inactiveFileKeyName]; ok {
859864
if workingSet < v {
860865
workingSet = 0
861866
} else {

0 commit comments

Comments
 (0)