Skip to content

Commit

Permalink
Move the process outside of the systemd cgroup
Browse files Browse the repository at this point in the history
If you don't move the process out of the named cgroup for systemd then
systemd will try to delete all the cgroups that the process is currently
in.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
  • Loading branch information
crosbymichael committed Feb 19, 2016
1 parent e28cfaf commit 47f16e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions libcontainer/cgroups/fs/apply_raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var (
&NetPrioGroup{},
&PerfEventGroup{},
&FreezerGroup{},
&NameGroup{GroupName: "name=systemd", Join: true},
}
CgroupProcesses = "cgroup.procs"
HugePageSizes, _ = cgroups.GetHugePageSize()
Expand Down
8 changes: 8 additions & 0 deletions libcontainer/cgroups/fs/name.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ import (

type NameGroup struct {
GroupName string
Join bool
}

func (s *NameGroup) Name() string {
return s.GroupName
}

func (s *NameGroup) Apply(d *cgroupData) error {
if s.Join {
// ignore errors if the named cgroup does not exist
d.join(s.GroupName)
}
return nil
}

Expand All @@ -24,6 +29,9 @@ func (s *NameGroup) Set(path string, cgroup *configs.Cgroup) error {
}

func (s *NameGroup) Remove(d *cgroupData) error {
if s.Join {
removePath(d.path(s.GroupName))
}
return nil
}

Expand Down

0 comments on commit 47f16e8

Please sign in to comment.