Documentation
¶
Overview ¶
Package cpuclass is the resource-manager-wide CPU class handler. It owns the per-CPU frequency, c-state, uncore-frequency and Intel Priority Core Turbo state implied by a list of user-facing CPU class definitions.
Policies talk to a single *Handler, constructed with New(sys). Configure(spec) installs (or replaces) the class set; UseClass pins given CPUs to a named class; Commit() flushes deferred per-CPU sysfs writes; Hints() returns placement preferences a policy can use when picking new CPUs for an allocation.
Index ¶
- type AllocationHints
- type AllocationIntent
- type ConfigSpec
- type CpuPreference
- type Handler
- func (h *Handler) AssignCPUs(name string, cpus []int)
- func (h *Handler) Commit() error
- func (h *Handler) Configure(spec ConfigSpec) error
- func (h *Handler) Hints(intent AllocationIntent) AllocationHints
- func (h *Handler) PctActive() bool
- func (h *Handler) PctFreeClassCapacity(className string, held cpuset.CPUSet) int
- func (h *Handler) SetClassDef(name string, def types.ClassDef)
- func (h *Handler) Shutdown() error
- func (h *Handler) UseClass(className string, cpus cpuset.CPUSet) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllocationHints ¶
type AllocationHints = types.AllocationHints
AllocationHints carries technology-agnostic placement preferences returned by Handler.Hints.
type AllocationIntent ¶
type AllocationIntent = types.AllocationIntent
AllocationIntent describes an upcoming CPU allocation for which the caller wants placement preferences.
type ConfigSpec ¶
type ConfigSpec struct {
// Classes is the user-facing list of CPU classes.
Classes []*policyapi.CPUClass
// TurboDomain selects the per-domain turbo arbitration scope.
// Empty resolves to "package".
TurboDomain string
// Allowed bounds every cpuclass operation. CPUs outside this
// set are silently dropped by Configure, UseClass and Hints.
Allowed cpuset.CPUSet
}
ConfigSpec carries cpuclass configuration applied via Handler.Configure. Idleness is intentionally absent: the caller decides which class name (if any) means "idle" and applies it via UseClass.
type CpuPreference ¶
type CpuPreference = types.CpuPreference
CpuPreference is a named CPU set carrying a single placement preference (prefer or avoid).
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the sole cpuclass entry point for policy code. It owns construction and configuration of the per-technology allocators (cpufreq, pct) and writers (cpufreq, cpuidle, uncorefreq).
func New ¶
New constructs a Handler with both internal allocators (cpufreq and pct) ready in a "no configuration applied" state. Configure must be called before the handler is usable.
func (*Handler) AssignCPUs ¶
AssignCPUs updates the (cpu -> synthetic class) map for the given CPUs. CPUs whose class changes are added to the dirty set. An empty class name means "no class". Implements the cpufreq.Sink interface.
func (*Handler) Commit ¶
Commit flushes pending cpufreq, cpuidle and uncore changes to sysfs. Per-property writes are deduplicated against the writers' lastWritten caches.
func (*Handler) Configure ¶
func (h *Handler) Configure(spec ConfigSpec) error
Configure (re)applies a configuration spec. Idempotent: may be called repeatedly with changed classes, turbo-domain mode, or allowed set.
func (*Handler) Hints ¶
func (h *Handler) Hints(intent AllocationIntent) AllocationHints
Hints returns technology-agnostic placement preferences for an upcoming CPU allocation. The returned CpuPreference sets are always subsets of the configured Allowed set.
func (*Handler) PctFreeClassCapacity ¶
PctFreeClassCapacity returns the number of logical CPUs that the PCT allocator can still route into the named cpuClass on this node, given that 'held' lists CPUs already consumed by some balloon belonging to any other cpuClass. Returns 0 if PCT is inactive or the class has no PCT plan.
func (*Handler) SetClassDef ¶
SetClassDef records a class definition keyed by its synthetic name. If the definition materially changes, every CPU currently assigned to that synthetic class is marked dirty. Implements the cpufreq.Sink interface.
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
cpufreq
Package cpufreq owns the cpufreq-side CPU-class lifecycle: resolution of symbolic frequencies (min/base/turbo), turbo-priority winner selection per turbo domain, and the per-CPU sysfs writes that follow.
|
Package cpufreq owns the cpufreq-side CPU-class lifecycle: resolution of symbolic frequencies (min/base/turbo), turbo-priority winner selection per turbo domain, and the per-CPU sysfs writes that follow. |
|
cpuidle
Package cpuidle is the C-state writer used by the cpuclass handler.
|
Package cpuidle is the C-state writer used by the cpuclass handler. |
|
types
Package types defines the internal class-definition struct used by the cpuclass writers (cpufreq, cpuidle, uncorefreq).
|
Package types defines the internal class-definition struct used by the cpuclass writers (cpufreq, cpuidle, uncorefreq). |
|
uncorefreq
Package uncorefreq is the per-die uncore frequency writer used by the cpuclass handler.
|
Package uncorefreq is the per-die uncore frequency writer used by the cpuclass handler. |