From fd92846686d5dd17dc3353aeb2a5d2f116282fb4 Mon Sep 17 00:00:00 2001 From: Wang Long <long.wanglong@huawei.com> Date: Tue, 13 Sep 2016 12:19:48 +0000 Subject: [PATCH] move m.GetPaths out of the loop only call m.GetPaths once is ok. os move it out of the loop. Signed-off-by: Wang Long <long.wanglong@huawei.com> --- libcontainer/cgroups/fs/apply_raw.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libcontainer/cgroups/fs/apply_raw.go b/libcontainer/cgroups/fs/apply_raw.go index b32f5068..9692e4fb 100644 --- a/libcontainer/cgroups/fs/apply_raw.go +++ b/libcontainer/cgroups/fs/apply_raw.go @@ -195,8 +195,9 @@ func (m *Manager) Set(container *configs.Config) error { if m.Cgroups.Paths != nil { return nil } + + paths := m.GetPaths() for _, sys := range subsystems { - paths := m.GetPaths() path := paths[sys.Name()] if err := sys.Set(path, container.Cgroups); err != nil { return err