Skip to content

Add per-container resource limits and upstream sync workflow#40384

Open
kvega005 wants to merge 14 commits intomicrosoft:masterfrom
kvega005:PerContainerProcMemLimits
Open

Add per-container resource limits and upstream sync workflow#40384
kvega005 wants to merge 14 commits intomicrosoft:masterfrom
kvega005:PerContainerProcMemLimits

Conversation

@kvega005
Copy link
Copy Markdown
Contributor

@kvega005 kvega005 commented May 1, 2026

Summary of the Pull Request

Introduce functionality for setting per-container memory limits, CPU quotas, and ulimits.

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Copilot AI review requested due to automatic review settings May 1, 2026 19:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) with MemoryBytes, NanoCpus, and Ulimits and 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.

Comment thread src/windows/service/inc/wslc.idl
Comment thread src/windows/wslcsession/WSLCContainer.cpp
Comment thread src/windows/wslcsession/WSLCContainer.cpp
Comment thread src/windows/wslcsession/WSLCContainer.cpp
@kvega005 kvega005 marked this pull request as ready for review May 1, 2026 20:19
@kvega005 kvega005 requested a review from a team as a code owner May 1, 2026 20:19
OneBlue
OneBlue previously approved these changes May 5, 2026
Comment thread src/windows/inc/wslc_schema.h Outdated
Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings May 5, 2026 20:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 a ULONG StructSize/Version field and have the server gate access to new fields based on that value.
/*++

Comment thread src/windows/wslcsession/WSLCContainer.cpp
Comment thread test/windows/WSLCTests.cpp
Comment thread src/windows/inc/docker_schema.h
Comment thread test/windows/WSLCTests.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants