Documentation
¶
Index ¶
- type Allocator
- func (a *Allocator) Active() bool
- func (a *Allocator) Configure(classes []*policyapi.CPUClass, allowed cpuset.CPUSet) error
- func (a *Allocator) FreeClassCapacity(className string, held cpuset.CPUSet) int
- func (a *Allocator) Hints(intent types.AllocationIntent) types.AllocationHints
- func (a *Allocator) Shutdown() error
- func (a *Allocator) UseClass(className string, cpus cpuset.CPUSet) error
- type Sys
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocator ¶
type Allocator struct {
// contains filtered or unexported fields
}
Allocator manages Intel Priority Core Turbo CLOS associations driven by cpuClass definitions.
func NewAllocator ¶
NewAllocator returns a new PCT allocator in the disabled mode.
func (*Allocator) Configure ¶
configure selects the PCT operating mode from the given cpuClass definitions and, in managed mode, programs the corresponding SST CLOSes. Honors `allowed` as the boundary of CPUs the allocator may touch.
- classes: cpuClass definitions to inspect for PCT fields.
- allowed: CPUs the allocator may configure.
func (*Allocator) FreeClassCapacity ¶
freeClassCapacity returns the number of logical CPUs that can still be allocated to className, given that 'held' lists CPUs already consumed by some balloon on this node (any class).
Same formula in managed and assoc-only modes:
- HP class: sum over HP-eligible punits of min(GuaranteedHpCpus, |pu.CPUs intersect Allowed minus held|). HP capacity is bounded by the punit's *guaranteed top-turbo* HP count (smallest non-zero SST-TF bucket HighPriorityCoreCount, or SST-BF HP CPU count when TF is unsupported) -- not by the larger MaxHpCpus the allocator uses for steering. The scheduler-visible capacity must reflect how many CPUs can *actually* sustain the highest turbo frequency this platform exposes; otherwise HP pods get scheduled past the guaranteed-turbo headroom and fall back to lower-bucket frequencies.
- non-HP class: |Allowed minus held|. The allocator can re-associate any Allowed CPU to any CLOS on demand, so the gating set is what the plugin owns, not what currently lives on the target CLOS in hardware.
The modes differ in how hpEligiblePunit is populated:
- Managed mode: every snapshotted punit is HP-eligible (the plugin enables SST-TF itself via PrepareManagedMode).
- Assoc-only mode: a punit is HP-eligible only when SST-TF is currently enabled on it (operator's responsibility). Punits where TF is disabled cannot exceed the standard turbo-ratio bucket and contribute 0 to HP capacity, so the scheduler does not bin-pack HP pods onto nodes that cannot deliver top turbo.
Returns 0 for classes that have no PCT plan or when PCT is not active. Negative intermediate counts are clamped to 0.
func (*Allocator) Hints ¶
func (a *Allocator) Hints(intent types.AllocationIntent) types.AllocationHints
hints returns prefer/avoid CPU sets that PCT would like an upcoming allocation under intent.ClassName to honor. Returned types.CpuPreference sets are not yet intersected with Allowed; the handler does that.
Behavior:
- Class has an explicit CLOS plan (assoc-only or managed): Prefer CLOS-member CPUs.
- Class is currently classified HP: Prefer hpReserveCpus (best-fit punit; same-package union as fallback), and also CLOS-member CPUs. No cross-package hint is ever emitted.
- Class is not HP and at least one HP class exists: Avoid hpInUseCpus (punits currently hosting HP work).
func (*Allocator) Shutdown ¶
Shutdown restores the platform to its default state. Safe to call multiple times.
func (*Allocator) UseClass ¶
useClass associates the given CPUs to the CLOS chosen for className. In managed mode, CPUs whose className is not a PCT class are associated to the fallback CLOS. In assoc-only mode such CPUs are left unchanged. CPUs outside the configured Allowed set are silently dropped.