mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Handle memory swappiness as a pointer to handle default/unset case
This prior fix to set "-1" explicitly was lost, and it is simpler to use the same pointer type from the OCI spec to handle nil pointer == -1 == unset case. Also, as a nearly humorous aside, there was a test for MemorySwappiness that was actually setting Memory, and it was passing because of this bug (as it was always setting everyone's MemorySwappiness to zero!) Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
This commit is contained in:
@@ -398,7 +398,8 @@ func createCgroupConfig(name string, spec *specs.LinuxSpec) (*configs.Cgroup, er
|
||||
c.Resources.KernelMemory = int64(*r.Memory.Kernel)
|
||||
}
|
||||
if r.Memory.Swappiness != nil {
|
||||
c.Resources.MemorySwappiness = int64(*r.Memory.Swappiness)
|
||||
swappiness := int64(*r.Memory.Swappiness)
|
||||
c.Resources.MemorySwappiness = &swappiness
|
||||
}
|
||||
}
|
||||
if r.CPU != nil {
|
||||
|
||||
Reference in New Issue
Block a user