mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
let runc disable swap in cgroup v2
In cgroup v2, when memory and memorySwap set to the same value which is greater than zero, runc should write zero in `memory.swap.max` to disable swap. Signed-off-by: lifubang <lifubang@acmcoder.com>
This commit is contained in:
@@ -639,7 +639,7 @@ func ConvertMemorySwapToCgroupV2Value(memorySwap, memory int64) (int64, error) {
|
||||
return 0, fmt.Errorf("invalid memory value: %d", memory)
|
||||
}
|
||||
if memorySwap < memory {
|
||||
return 0, errors.New("memory+swap limit should be > memory limit")
|
||||
return 0, errors.New("memory+swap limit should be >= memory limit")
|
||||
}
|
||||
|
||||
return memorySwap - memory, nil
|
||||
|
||||
Reference in New Issue
Block a user