cgroups: simplify the join_memory check
If c.Memory=0, there is no point to set memoryswap. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
parent
c4821b6f3e
commit
46573774a2
|
@ -133,7 +133,7 @@ func Apply(c *cgroups.Cgroup, pid int) (map[string]string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// -1 disables memorySwap
|
// -1 disables memorySwap
|
||||||
if c.MemorySwap >= 0 && (c.Memory != 0 || c.MemorySwap > 0) {
|
if c.MemorySwap >= 0 && c.Memory != 0 {
|
||||||
if err := joinMemory(c, pid); err != nil {
|
if err := joinMemory(c, pid); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue