From 4af5beda358074885a28da160751ba02898ef847 Mon Sep 17 00:00:00 2001 From: Maruth Goyal Date: Wed, 9 Dec 2020 15:13:25 +0530 Subject: [PATCH] agent/sandbox: Don't update cpuset when ncpus = 0 When receiving an OnlineCpuMemory RPC, if the number of CPUs to be made available is 0, then updating the cpusets is a redundant operation. Fixes: #1172 Signed-off-by: Maruth Goyal --- src/agent/src/sandbox.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/agent/src/sandbox.rs b/src/agent/src/sandbox.rs index 907671661a..7aa27e8ba8 100644 --- a/src/agent/src/sandbox.rs +++ b/src/agent/src/sandbox.rs @@ -233,6 +233,10 @@ impl Sandbox { online_memory(&self.logger)?; } + if req.nb_cpus == 0 { + return Ok(()); + } + let guest_cpuset = rustjail_cgroups::fs::get_guest_cpuset()?; for (_, ctr) in self.containers.iter() {