From b5b8870e47071620c336006b107ebb4d1e1b59c7 Mon Sep 17 00:00:00 2001 From: Eric Ernst Date: Thu, 10 Sep 2020 13:56:02 -0700 Subject: [PATCH] cpuset: don't set cpuset.mems in the guest Kata doesn't map any numa topologies in the guest. Let's make sure we clear the Cpuset fields before passing container updates to the guest. Without this, we could encounter a runtime failure: ``` process_linux.go:297: applying cgroup configuration for process caused "failed to write 0,1 to cpuset.mems: writea 0,1 to cpuset.mems: write 0,1 to cpuset.mems: write /sys/fs/cgroup/cpuset .... /cpuset.mems: numerical result out of range"": unknown ``` Note, in the future we may want to have a vCPU to guest CPU mapping and still include the cpuset.Cpus. Until we have this support, clear this as well. Fixes: #2176 Depends-on: github.com/kata-containers/tests#2846 Signed-off-by: Eric Ernst --- virtcontainers/container.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/virtcontainers/container.go b/virtcontainers/container.go index 2f5279c866..6b57f2c40e 100644 --- a/virtcontainers/container.go +++ b/virtcontainers/container.go @@ -1275,6 +1275,14 @@ func (c *Container) update(resources specs.LinuxResources) error { } } + // There currently isn't a notion of cpusets.cpus or mems being tracked + // inside of the guest. Make sure we clear these before asking agent to update + // the container's cgroups. + if resources.CPU != nil { + resources.CPU.Mems = "" + resources.CPU.Cpus = "" + } + return c.sandbox.agent.updateContainer(c.sandbox, *c, resources) }