diff --git a/Package.resolved b/Package.resolved index 9e5b6023..eb15b150 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "98abcd5d2cfb4a9f7e49f459bb61c7d3b1c84927d31a12760a5072be5f67a2bc", + "originHash" : "33393fe7d642230413774a71152bd59d37673aa565229fd537824622e0d462cd", "pins" : [ { "identity" : "async-http-client", @@ -15,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/containerization.git", "state" : { - "revision" : "9eacc197d7c3663eb29cbab6d51244ede6d1cd7d", - "version" : "0.45.0" + "revision" : "bc994b88df46207fad7775b0eabc51947e315881", + "version" : "0.47.0" } }, { diff --git a/Package.swift b/Package.swift index 8f95ebf1..147506d5 100644 --- a/Package.swift +++ b/Package.swift @@ -23,7 +23,7 @@ import PackageDescription let releaseVersion = ProcessInfo.processInfo.environment["RELEASE_VERSION"] ?? "0.0.0" let gitCommit = ProcessInfo.processInfo.environment["GIT_COMMIT"] ?? "unspecified" let builderShimVersion = "0.13.1" -let scVersion = "0.45.0" +let scVersion = "0.47.0" let package = Package( name: "container", diff --git a/Sources/Services/RuntimeLinux/Server/RuntimeService.swift b/Sources/Services/RuntimeLinux/Server/RuntimeService.swift index 951404a3..cbb36b25 100644 --- a/Sources/Services/RuntimeLinux/Server/RuntimeService.swift +++ b/Sources/Services/RuntimeLinux/Server/RuntimeService.swift @@ -263,7 +263,13 @@ public actor RuntimeService { let id = config.id let rootfs = try bundle.containerRootfs.asMount - let container = try LinuxContainer(id, rootfs: rootfs, vmm: vmm, logger: self.log) { czConfig in + // Give the VM headroom beyond the container's cgroup limits for the guest kernel, + // vminitd, and the overhead configured via `config.resources.cpuOverhead`. + let vmResources = VMResources( + cpus: config.resources.cpus + config.resources.cpuOverhead, + memoryInBytes: config.resources.memoryInBytes + VMResources.guestMemoryOverhead + ) + let container = try LinuxContainer(id, rootfs: rootfs, vmm: vmm, vm: vmResources, logger: self.log) { czConfig in try Self.configureContainer(czConfig: &czConfig, config: config, dynamicEnv: dynamicEnv, log: self.log) czConfig.interfaces = interfaces czConfig.process.stdout = stdout @@ -1116,7 +1122,6 @@ public actor RuntimeService { log: Logger? = nil, ) throws { czConfig.cpus = config.resources.cpus - czConfig.cpuOverhead = config.resources.cpuOverhead czConfig.memoryInBytes = config.resources.memoryInBytes // Overcommit memory and allow more memory mappings than the kernel default // so workloads inside swap-less guest VMs hit limits less easily.