From a675b5ebea01f07a97570f1d9b2fe8b1325278da Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 25 Mar 2020 19:52:28 -0700 Subject: [PATCH] cgroupv2: don't try to set kmem for systemd case To the best of my knowledge, it has been decided to drop the kernel memory controller from the cgroupv2 hierarchy, so "kernel memory limits" do not exist if we're using v2 unified. So, we need to ignore kernel memory setting. This was already done in non-systemd case (see commit 88e8350de), let's do the same for systemd. This fixes the following error: > container_linux.go:349: starting container process caused "process_linux.go:306: applying cgroup configuration for process caused \"open /sys/fs/cgroup/machine.slice/runc-cgroups-integration-test.scope/tasks: no such file or directory\"" Signed-off-by: Kir Kolyshkin --- libcontainer/cgroups/systemd/unified_hierarchy.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libcontainer/cgroups/systemd/unified_hierarchy.go b/libcontainer/cgroups/systemd/unified_hierarchy.go index ea76f4cf..d05ecacb 100644 --- a/libcontainer/cgroups/systemd/unified_hierarchy.go +++ b/libcontainer/cgroups/systemd/unified_hierarchy.go @@ -126,13 +126,7 @@ func (m *UnifiedManager) Apply(pid int) error { properties = append(properties, c.SystemdProps...) - // We have to set kernel memory here, as we can't change it once - // processes have been attached to the cgroup. - if c.Resources.KernelMemory != 0 { - if err := setKernelMemory(c); err != nil { - return err - } - } + // ignore c.Resources.KernelMemory statusChan := make(chan string, 1) if _, err := theConn.StartTransientUnit(unitName, "replace", properties, statusChan); err == nil {