From 4ddfffcab3edf3d05ee8319e87410fe747979a04 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 10 Apr 2014 20:08:56 +0200 Subject: [PATCH] Join memory and cpu cgroup in systemd too Docker-DCO-1.1-Signed-off-by: Alexander Larsson (github: alexlarsson) Docker-DCO-1.1-Signed-off-by: Alexander Larsson (github: crosbymichael) --- pkg/cgroups/apply_systemd.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/cgroups/apply_systemd.go b/pkg/cgroups/apply_systemd.go index c689d5753e..a9b3a8d301 100644 --- a/pkg/cgroups/apply_systemd.go +++ b/pkg/cgroups/apply_systemd.go @@ -107,6 +107,12 @@ func systemdApply(c *Cgroup, pid int) (ActiveCgroup, error) { })}) } + // Always enable accounting, this gets us the same behaviour as the raw implementation, + // plus the kernel has some problems with joining the memory cgroup at a later time. + properties = append(properties, + systemd1.Property{"MemoryAccounting", dbus.MakeVariant(true)}, + systemd1.Property{"CPUAccounting", dbus.MakeVariant(true)}) + if c.Memory != 0 { properties = append(properties, systemd1.Property{"MemoryLimit", dbus.MakeVariant(uint64(c.Memory))})