@@ -263,7 +263,13 @@ public actor RuntimeService {
263263
264264 let id = config. id
265265 let rootfs = try bundle. containerRootfs. asMount
266- let container = try LinuxContainer ( id, rootfs: rootfs, vmm: vmm, logger: self . log) { czConfig in
266+ // Give the VM headroom beyond the container's cgroup limits for the guest kernel,
267+ // vminitd, and the overhead configured via `config.resources.cpuOverhead`.
268+ let vmResources = VMResources (
269+ cpus: config. resources. cpus + config. resources. cpuOverhead,
270+ memoryInBytes: config. resources. memoryInBytes + VMResources. guestMemoryOverhead
271+ )
272+ let container = try LinuxContainer ( id, rootfs: rootfs, vmm: vmm, vm: vmResources, logger: self . log) { czConfig in
267273 try Self . configureContainer ( czConfig: & czConfig, config: config, dynamicEnv: dynamicEnv, log: self . log)
268274 czConfig. interfaces = interfaces
269275 czConfig. process. stdout = stdout
@@ -1116,7 +1122,6 @@ public actor RuntimeService {
11161122 log: Logger? = nil ,
11171123 ) throws {
11181124 czConfig. cpus = config. resources. cpus
1119- czConfig. cpuOverhead = config. resources. cpuOverhead
11201125 czConfig. memoryInBytes = config. resources. memoryInBytes
11211126 // Overcommit memory and allow more memory mappings than the kernel default
11221127 // so workloads inside swap-less guest VMs hit limits less easily.
0 commit comments