Skip to content

Commit fd1ac23

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

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

config-windows.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ 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.
8586

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

specs-go/config.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,17 @@ type WindowsCPUResources struct {
635635
// cycles per 10,000 cycles. Set processor `maximum` to a percentage times
636636
// 100.
637637
Maximum *uint16 `json:"maximum,omitempty"`
638+
// Set of CPUs to affinitize for this container.
639+
AffinityCPUs []WindowsCPUGroupAffinity `json:"affinityCPUs,omitempty"`
640+
}
641+
642+
// Similar to _GROUP_AFFINITY struct defined in
643+
// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/miniport/ns-miniport-_group_affinity
644+
type WindowsCPUGroupAffinity struct {
645+
// CPU mask relative to this CPU group.
646+
CPUMask uint64 `json:"cpuMask,omitempty"`
647+
// CPU group that this CPU belongs to.
648+
CPUGroup uint32 `json:"cpuGroup,omitempty"`
638649
}
639650

640651
// WindowsStorageResources contains storage resource management settings.

0 commit comments

Comments
 (0)