runc/libcontainer/cgroups
Kir Kolyshkin d57f5bb286 cgroupv1: don't ignore MemorySwap if Memory==-1
Commit 18ebc51b3cc3 "Reset Swap when memory is set to unlimited (-1)"
added handling of the case when a user updates the container limits
to set memory to unlimited (-1) but do not set any other limits.
Apparently, in this case, if swap limit was previously set, kernel fails
to set memory.limit_in_bytes to -1 if memory.memsw.limit_in_bytes is
not set to -1.

What the above commit fails to handle correctly is the request when
Memory is set to -1 and MemorySwap is set to some specific limit N
(where N > 0). In this case, the value of N is silently discarded
and MemorySwap is set to -1 instead.

This is wrong thing to do, as the limit set, even if incorrectly,
should not be ignored.

Fix this by only assigning MemorySwap == -1 in case it was not
explicitly set.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-05-20 17:23:40 -07:00
..
devices cgroups: add copyright header to devices.Emulator implementation 2020-05-15 11:29:51 +10:00
ebpf configs: use different types for .Devices and .Resources.Devices 2020-05-13 17:38:45 +10:00
fs cgroupv1: don't ignore MemorySwap if Memory==-1 2020-05-20 17:23:40 -07:00
fs2 never write empty string to memory.swap.max 2020-05-16 06:52:14 +08:00
fscommon cgroups/fscommon: use errors.Is 2020-04-18 16:16:49 -07:00
systemd cgroups/systemd: allow to set -1 as pids.limit 2020-05-20 13:20:04 -07:00
cgroups.go cgroups: add GetFreezerState() helper to Manager 2020-05-13 17:38:45 +10:00
cgroups_test.go .travis.yml: add Fedora 31 vagrant box (for cgroup2) 2019-10-31 16:53:01 +09:00
cgroups_unsupported.go Move libcontainer into subdirectory 2015-06-21 19:29:15 -07:00
stats.go Add reading of information from cpuacct.usage_all 2020-05-05 08:51:12 +02:00
utils.go libct/cgroups: rm GetClosestMountpointAncestor 2020-05-13 17:32:06 -07:00
utils_test.go libct/cgroups: rm GetClosestMountpointAncestor 2020-05-13 17:32:06 -07:00