Skip to content

Commit e85a1c8

Browse files
committed
Add support for windows CPU affinity
Signed-off-by: Kirtana Ashok <[email protected]>
1 parent 2d3f72e commit e85a1c8

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

config-windows.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ The following parameters can be specified (mutually exclusive):
8282
* **`count`** *(uint64, OPTIONAL)* - specifies the number of CPUs available to the container. It represents the fraction of the configured processor `count` in a container in relation to the processors available in the host. The fraction ultimately determines the portion of processor cycles that the threads in a container can use during each scheduling interval, as the number of cycles per 10,000 cycles.
8383
* **`shares`** *(uint16, OPTIONAL)* - limits the share of processor time given to the container relative to other workloads on the processor. The processor `shares` (`weight` at the platform level) is a value between 0 and 10,000.
8484
* **`maximum`** *(uint16, OPTIONAL)* - determines the portion of processor cycles that the threads in a container can use during each scheduling interval, as the number of cycles per 10,000 cycles. Set processor `maximum` to a percentage times 100.
85+
* **`affinityCPUs`** *(object, OPTIONAL)* - specifies the set of CPU to affinitize for this container.
86+
* **`affinityPreferredNumaNodes`** *(uint32, OPTIONAL)* - specifies referred set of numa node numbers to affinitize for this container.
8587

8688
Ref: https://docs.microsoft.com/en-us/virtualization/api/hcs/schemareference#Container_Processor
8789

specs-go/config.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,19 @@ type WindowsCPUResources struct {
627627
// cycles per 10,000 cycles. Set processor `maximum` to a percentage times
628628
// 100.
629629
Maximum *uint16 `json:"maximum,omitempty"`
630+
// Set of CPUs to affinitize for this container.
631+
AffinityCPUs []WindowsCPUGroupAffinity `json:"affinityCPUs,omitempty"`
632+
// Specifies preferred set of numa node numbers to affinitize for this container.
633+
AffinityPreferredNumaNodes []uint32 `json:"affinityPreferredNumaNodes,omitempty"`
634+
}
635+
636+
// Similar to _GROUP_AFFINITY struct defined in
637+
// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/miniport/ns-miniport-_group_affinity
638+
type WindowsCPUGroupAffinity struct {
639+
// CPU mask relative to this CPU group.
640+
CPUMask uint64 `json:"cpuMask,omitempty"`
641+
// Processor group the mask refers to, as returned by GetLogicalProcessorInformationEx.
642+
CPUGroup uint32 `json:"cpuGroup,omitempty"`
630643
}
631644

632645
// WindowsStorageResources contains storage resource management settings.

0 commit comments

Comments
 (0)