From 662e8db5dd188ba0ca78b142716df904e254d157 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 Signed-off-by: Peng Tao --- 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 ee5ab08f98..b831119289 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 cpuset = rustjail_cgroups::fs::get_guest_cpuset()?; for (_, ctr) in self.containers.iter() {