Skip to content

Commit c32acc0

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 b686a10 commit c32acc0

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

745+
inactiveFileKeyName := "total_inactive_file"
746+
if cgroups.IsCgroup2UnifiedMode() {
747+
inactiveFileKeyName = "inactive_file"
748+
}
749+
745750
workingSet := ret.Memory.Usage
746-
if v, ok := s.MemoryStats.Stats["total_inactive_file"]; ok {
751+
if v, ok := s.MemoryStats.Stats[inactiveFileKeyName]; ok {
747752
if workingSet < v {
748753
workingSet = 0
749754
} else {

0 commit comments

Comments
 (0)