hcsoci: wire Windows CPU affinity to HCS container processor schema#2693
Open
wenyang wants to merge 9 commits into
Open
hcsoci: wire Windows CPU affinity to HCS container processor schema#2693wenyang wants to merge 9 commits into
wenyang wants to merge 9 commits into
Conversation
Contributor
Author
|
Phase 1 PR: #2603 |
helsaawy
approved these changes
Apr 21, 2026
apurv15
reviewed
Apr 23, 2026
apurv15
approved these changes
Apr 23, 2026
jterry75
reviewed
Apr 28, 2026
8fe80ae to
587fb68
Compare
helsaawy
approved these changes
May 11, 2026
added 3 commits
May 12, 2026 15:57
Summary - Add Affinity field to hcsschema.Processor struct. - Add ConvertCPUAffinity function to validate and extract CPU affinity from OCI spec. - Wire CPU affinity into HCS silo container creation via createWindowsContainerDocument. - Add affinity support to updateWCOWContainerCPU for container updates. - Add unit tests for ConvertCPUAffinity validation. Motivation This is Phase 2 of Windows CPU affinity support, enabling HCS silo containers (non-JobObject path) to use CPU affinity specified in the OCI spec. Limitations (intentional for Phase 2) - Multiple affinity entries are rejected. - Non-zero processor groups are rejected. Signed-off-by: Weyang1 <weyang1@microsoft.com>
- Remove Affinity uint64 from schema2/Processor (not a real HCS API field); preserve ConvertCPUAffinity validation with a TODO to wire it properly once the correct schema field is confirmed - Define sentinel errors (ErrCPUAffinityMultipleGroups, ErrCPUAffinityNonZeroGroup, ErrCPUAffinityMaskZero) and replace strings.Contains checks in tests with errors.Is for more robust error identity verification Signed-off-by: Weyang1 <weyang1@microsoft.com>
587fb68 to
4782c00
Compare
linliu-msft-git
approved these changes
May 12, 2026
|
Not a blocker for this PR, but can we add some component level tests for this? |
added 4 commits
May 18, 2026 18:20
Signed-off-by: Weyang1 <weyang1@microsoft.com>
…null-probe Signed-off-by: Weyang1 <weyang1@microsoft.com>
Signed-off-by: Weyang1 <weyang1@microsoft.com>
Signed-off-by: Weyang1 <weyang1@microsoft.com>
bef6985 to
296a13c
Compare
helsaawy
requested changes
May 21, 2026
Contributor
helsaawy
left a comment
There was a problem hiding this comment.
I do not think the HCS portion of the CPU affinity settings is correct.
additionally, the changes to updateWCOWContainerCPU wont work for job containers since they do not support modification in general:
hcsshim/internal/jobcontainers/jobcontainer.go
Lines 424 to 426 in ab454d9
Co-authored-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
…hema The ProcessorGroupAffinity struct and GroupAffinities field on Processor did not correspond to any real HCS container processor schema field. HCS containers only support Count/Maximum/Weight for the Processor resource; GROUP_AFFINITY-style pinning is a job-object concept (SetInformationJobObject / JobObjectGroupInformationEx) and is already applied correctly via SetCPUGroupAffinities at container creation time for job containers. Remove: - internal/hcs/schema2/processor_group_affinity.go (invented type) - Processor.GroupAffinities field - ConvertCPUAffinity call and v2Processor.GroupAffinities assignment in hcsdoc_wcow.go - Affinity block in updateWCOWContainerCPU in task_hcs.go
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
Motivation
This is Phase 2 of Windows CPU affinity support, enabling HCS silo containers (non-JobObject path) to use CPU affinity specified in the OCI spec.
Limitations (intentional for Phase 2)