mirror of
https://github.com/criyle/go-sandbox.git
synced 2025-11-04 14:49:53 +08:00
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:
commit
7aeb9869c5
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user