Merge pull request #3 from AlphaNecron/max_mem_cgv2

use memory.peak for cgroup v2 to replicate max_usage_in_bytes in v1 (for kernel >= 5.19)
This commit is contained in:
Yang Gao 2023-08-10 20:34:28 +08:00 committed by GitHub
commit 7aeb9869c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,9 +48,9 @@ func (c *CgroupV2) MemoryUsage() (uint64, error) {
return c.ReadUint("memory.current")
}
// MemoryMaxUsage not exist, use rusage.max_rss instead
// MemoryMaxUsage reads memory.peak
func (c *CgroupV2) MemoryMaxUsage() (uint64, error) {
return 0, os.ErrNotExist
return c.ReadUint("memory.peak")
}
// SetCPUBandwidth set cpu.max quota period