From a949e4f22fa95c8a5ecd3da1c69c5c5456ee306d Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 26 Mar 2020 13:57:55 -0700 Subject: [PATCH] cgroupv2: UnifiedManager.Apply: simplify Remove joinCgroupsV2() function, as its name and second parameter are misleading. Use createCgroupsv2Path() directly, do not call getv2Path() twice. Signed-off-by: Kir Kolyshkin --- libcontainer/cgroups/systemd/unified_hierarchy.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/libcontainer/cgroups/systemd/unified_hierarchy.go b/libcontainer/cgroups/systemd/unified_hierarchy.go index 76004e655..308a79175 100644 --- a/libcontainer/cgroups/systemd/unified_hierarchy.go +++ b/libcontainer/cgroups/systemd/unified_hierarchy.go @@ -130,14 +130,13 @@ func (m *UnifiedManager) Apply(pid int) error { return err } - if err := joinCgroupsV2(c, pid); err != nil { - return err - } - path, err := getv2Path(m.Cgroups) if err != nil { return err } + if err := createCgroupsv2Path(path); err != nil { + return err + } m.Paths = map[string]string{ "pids": path, "memory": path, @@ -239,14 +238,6 @@ func createCgroupsv2Path(path string) (Err error) { return nil } -func joinCgroupsV2(c *configs.Cgroup, pid int) error { - path, err := getv2Path(c) - if err != nil { - return err - } - return createCgroupsv2Path(path) -} - func (m *UnifiedManager) fsManager() (cgroups.Manager, error) { path, err := m.GetUnifiedPath() if err != nil {