use memory.peak for cgroup v2 as an alternative to max_usage_in_bytes

This commit is contained in:
Nguyen Thanh Quang 2023-08-04 23:12:23 +07:00 committed by GitHub
parent 25d0f22364
commit 656b493a3f
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