From 82ec5cb0360418dba8df3294b2e54c758dbe8564 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 3 Jun 2014 15:15:11 -0700 Subject: [PATCH] Don't rejoin the cgroup each time Docker-DCO-1.1-Signed-off-by: Michael Crosby (github: crosbymichael) --- libcontainer/cgroups/fs/freezer.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libcontainer/cgroups/fs/freezer.go b/libcontainer/cgroups/fs/freezer.go index ed57f8b..432018f 100644 --- a/libcontainer/cgroups/fs/freezer.go +++ b/libcontainer/cgroups/fs/freezer.go @@ -12,18 +12,20 @@ type freezerGroup struct { } func (s *freezerGroup) Set(d *data) error { - dir, err := d.join("freezer") - if err != nil { - if err != cgroups.ErrNotFound { + switch d.c.Freezer { + case cgroups.Frozen, cgroups.Thawed: + dir, err := d.path("freezer") + if err != nil { return err } - return nil - } - if d.c.Freezer != cgroups.Undefined { if err := writeFile(dir, "freezer.state", string(d.c.Freezer)); err != nil { return err } + default: + if _, err := d.join("freezer"); err != nil && err != cgroups.ErrNotFound { + return err + } } return nil