Add per-container resource limits and upstream sync workflow#40384
Open
kvega005 wants to merge 14 commits intomicrosoft:masterfrom
Open
Add per-container resource limits and upstream sync workflow#40384kvega005 wants to merge 14 commits intomicrosoft:masterfrom
kvega005 wants to merge 14 commits intomicrosoft:masterfrom
Conversation
Co-authored-by: Copilot <copilot@github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for configuring per-container resource limits in WSLC containers (memory, CPU quota via NanoCpus, and ulimits), wiring the settings through the WSLC COM API into Docker create requests and surfacing them back via container.Inspect().
Changes:
- Extend
WSLCContainerOptions(IDL) withMemoryBytes,NanoCpus, andUlimitsand plumb them into container creation. - Extend Docker/WSLC inspect JSON schemas to include these fields and map them into inspect output.
- Add Windows tests validating cgroup limit application, ulimit application, inspect round-tripping, and invalid argument cases.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/WSLCTests.cpp | Adds ContainerResourceLimits test coverage for memory/cpu/ulimits and inspect round-trip + invalid args. |
| src/windows/wslcsession/WSLCContainer.cpp | Maps new option fields into Docker create request and maps Docker inspect fields into WSLC inspect output. |
| src/windows/service/inc/wslc.idl | Extends the COM options struct and introduces WSLCUlimit. |
| src/windows/inc/wslc_schema.h | Extends WSLC inspect schema to include Memory/NanoCpus/Ulimits. |
| src/windows/inc/docker_schema.h | Extends Docker HostConfig schema to include Memory/NanoCpus/Ulimits. |
| src/windows/common/WSLCContainerLauncher.h | Adds helper APIs/state to set per-container limits in tests/utilities. |
| src/windows/common/WSLCContainerLauncher.cpp | Implements the new launcher setters and passes fields into WSLCContainerOptions. |
OneBlue
previously approved these changes
May 5, 2026
Co-authored-by: Copilot <copilot@github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
src/windows/service/inc/wslc.idl:1
- Extending an IDL-defined struct used across a COM/RPC boundary is not safely backward-compatible unless the interface is explicitly versioned or the struct carries an explicit size/version field (older clients/proxies may not marshal the added trailing fields). Consider introducing a new options struct (e.g.,
WSLCContainerOptions2) and a new method (e.g.,CreateContainer2), or add aULONG StructSize/Versionfield and have the server gate access to new fields based on that value.
/*++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Introduce functionality for setting per-container memory limits, CPU quotas, and ulimits.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed