cgroupv2: UnifiedManager.Apply: simplify
Remove joinCgroupsV2() function, as its name and second parameter
are misleading. Use createCgroupsv2Path() directly, do not call
getv2Path() twice.
@@ -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 {
