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.
@@ -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
