From ec1f957b23ee1a2d49cd6981d2b075d5a26b01ce Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 26 Mar 2020 13:30:20 -0700 Subject: [PATCH] cgroupv2: don't use getSubsystemPath in Apply This code is a copy-paste from cgroupv1 systemd code. Its aim is to check whether a subsystem is available, and skip those that are not. In case v2 unified hierarchy is used, getSubsystemPath never returns "not found" error, so calling it is useless. Signed-off-by: Kir Kolyshkin --- libcontainer/cgroups/systemd/unified_hierarchy.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/libcontainer/cgroups/systemd/unified_hierarchy.go b/libcontainer/cgroups/systemd/unified_hierarchy.go index d05ecacb..79558156 100644 --- a/libcontainer/cgroups/systemd/unified_hierarchy.go +++ b/libcontainer/cgroups/systemd/unified_hierarchy.go @@ -38,14 +38,6 @@ func (m *UnifiedManager) Apply(pid int) error { if c.Paths != nil { paths := make(map[string]string) for name, path := range c.Paths { - _, err := getSubsystemPath(m.Cgroups, name) - if err != nil { - // Don't fail if a cgroup hierarchy was not found, just skip this subsystem - if cgroups.IsNotFound(err) { - continue - } - return err - } paths[name] = path } m.Paths = paths