Skip to content

Commit 3c6e309

Browse files
authored
Merge pull request #3001 from bobrik/ivan/fix-swap-accounting-v2
cgroupv2: fix swap accounting
2 parents 79b4c64 + ef98eb4 commit 3c6e309

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

container/libcontainer/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ func setMemoryStats(s *cgroups.Stats, ret *info.ContainerStats) {
806806
if cgroups.IsCgroup2UnifiedMode() {
807807
ret.Memory.Cache = s.MemoryStats.Stats["file"]
808808
ret.Memory.RSS = s.MemoryStats.Stats["anon"]
809-
ret.Memory.Swap = s.MemoryStats.SwapUsage.Usage
809+
ret.Memory.Swap = s.MemoryStats.SwapUsage.Usage - s.MemoryStats.Usage.Usage
810810
ret.Memory.MappedFile = s.MemoryStats.Stats["file_mapped"]
811811
} else if s.MemoryStats.UseHierarchy {
812812
ret.Memory.Cache = s.MemoryStats.Stats["total_cache"]

0 commit comments

Comments
 (0)