Skip to content

Commit ab2da09

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 6a95c22 commit ab2da09

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
@@ -850,8 +850,13 @@ func setMemoryStats(s *cgroups.Stats, ret *info.ContainerStats) {
850850
ret.Memory.HierarchicalData.Pgmajfault = v
851851
}
852852

853+
inactiveFileKeyName := "total_inactive_file"
854+
if cgroups.IsCgroup2UnifiedMode() {
855+
inactiveFileKeyName = "inactive_file"
856+
}
857+
853858
workingSet := ret.Memory.Usage
854-
if v, ok := s.MemoryStats.Stats["total_inactive_file"]; ok {
859+
if v, ok := s.MemoryStats.Stats[inactiveFileKeyName]; ok {
855860
if workingSet < v {
856861
workingSet = 0
857862
} else {

0 commit comments

Comments
 (0)