cgroupv1: check cpu shares in place

Commit 4e65e0e90a added a check for cpu shares. Apparently, the
kernel allows to set a value higher than max or lower than min without
an error, but the value read back is always within the limits.

The check (which was later moved out to a separate CheckCpushares()
function) is always performed after setting the cpu shares, so let's
move it to the very place where it is set.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2020-05-29 14:28:16 -07:00
parent 774a9e7641
commit 3249e2379c
3 changed files with 14 additions and 39 deletions
-5
View File
@@ -435,11 +435,6 @@ func (m *legacyManager) Set(container *configs.Config) error {
}
}
if m.paths["cpu"] != "" {
if err := fs.CheckCpushares(m.paths["cpu"], container.Cgroups.Resources.CpuShares); err != nil {
return err
}
}
return nil
}