kubernetesk8s.io/kubernetes/pkg/kubelet/cm/cpumanager/topology Index | Files

package topology

import "k8s.io/kubernetes/pkg/kubelet/cm/cpumanager/topology"

Package topology contains helpers for the CPU manager.

Index

Types

type Alignment

type Alignment struct {
	// UncoreCache is true if all the CPUs are uncore-cache aligned,
	// IOW if they all share the same Uncore cache block.
	// If the allocated CPU count is greater than a Uncore Group size,
	// CPUs can't be uncore-aligned; otherwise, they are.
	// This flag tracks alignment, not interference or lack thereof.
	UncoreCache bool
}

Alignment is metadata about a cpuset allocation

func (Alignment) String

func (ca Alignment) String() string

type Allocation

type Allocation struct {
	CPUs    cpuset.CPUSet
	Aligned Alignment
}

Allocation represents a CPU set plus alignment metadata

func EmptyAllocation

func EmptyAllocation() Allocation

EmptyAllocation returns a new zero-valued CPU allocation. Please note that a empty cpuset is aligned according to every possible way we can consider

func (Allocation) String

func (ca Allocation) String() string

type CPUDetails

type CPUDetails map[int]CPUInfo

CPUDetails is a map from CPU ID to Core ID, Socket ID, and NUMA ID.

func (CPUDetails) CPUs

func (d CPUDetails) CPUs() cpuset.CPUSet

CPUs returns all of the logical CPU IDs in this CPUDetails.

func (CPUDetails) CPUsInCores

func (d CPUDetails) CPUsInCores(ids ...int) cpuset.CPUSet

CPUsInCores returns all of the logical CPU IDs associated with the given core IDs in this CPUDetails.

func (CPUDetails) CPUsInNUMANodes

func (d CPUDetails) CPUsInNUMANodes(ids ...int) cpuset.CPUSet

CPUsInNUMANodes returns all of the logical CPU IDs associated with the given NUMANode IDs in this CPUDetails.

func (CPUDetails) CPUsInSockets

func (d CPUDetails) CPUsInSockets(ids ...int) cpuset.CPUSet

CPUsInSockets returns all of the logical CPU IDs associated with the given socket IDs in this CPUDetails.

func (CPUDetails) CPUsInUncoreCaches

func (d CPUDetails) CPUsInUncoreCaches(ids ...int) cpuset.CPUSet

CPUsInUncoreCaches returns all the logical CPU IDs associated with the given UnCoreCache IDs in this CPUDetails

func (CPUDetails) Cores

func (d CPUDetails) Cores() cpuset.CPUSet

Cores returns all of the core IDs associated with the CPUs in this CPUDetails.

func (CPUDetails) CoresInNUMANodes

func (d CPUDetails) CoresInNUMANodes(ids ...int) cpuset.CPUSet

CoresInNUMANodes returns all of the core IDs associated with the given NUMANode IDs in this CPUDetails.

func (CPUDetails) CoresInSockets

func (d CPUDetails) CoresInSockets(ids ...int) cpuset.CPUSet

CoresInSockets returns all of the core IDs associated with the given socket IDs in this CPUDetails.

func (CPUDetails) CoresNeededInUncoreCache

func (d CPUDetails) CoresNeededInUncoreCache(numCoresNeeded int, ids ...int) cpuset.CPUSet

CoresNeededInUncoreCache returns either the full list of all available unique core IDs associated with the given UnCoreCache IDs in this CPUDetails or subset that matches the ask.

func (CPUDetails) KeepOnly

func (d CPUDetails) KeepOnly(cpus cpuset.CPUSet) CPUDetails

KeepOnly returns a new CPUDetails object with only the supplied cpus.

func (CPUDetails) NUMANodes

func (d CPUDetails) NUMANodes() cpuset.CPUSet

NUMANodes returns all of the NUMANode IDs associated with the CPUs in this CPUDetails.

func (CPUDetails) NUMANodesInSockets

func (d CPUDetails) NUMANodesInSockets(ids ...int) cpuset.CPUSet

NUMANodesInSockets returns all of the logical NUMANode IDs associated with the given socket IDs in this CPUDetails.

func (CPUDetails) Sockets

func (d CPUDetails) Sockets() cpuset.CPUSet

Sockets returns all of the socket IDs associated with the CPUs in this CPUDetails.

func (CPUDetails) SocketsInNUMANodes

func (d CPUDetails) SocketsInNUMANodes(ids ...int) cpuset.CPUSet

SocketsInNUMANodes returns all of the logical Socket IDs associated with the given NUMANode IDs in this CPUDetails.

func (CPUDetails) UncoreCaches

func (d CPUDetails) UncoreCaches() cpuset.CPUSet

UncoreCaches returns all the uncorecache Id (L3 Index) associated with the CPUs in this CPUDetails

func (CPUDetails) UncoreInNUMANodes

func (d CPUDetails) UncoreInNUMANodes(ids ...int) cpuset.CPUSet

UnCoresInNUMANodes returns all of the uncore IDs associated with the given NUMANode IDs in this CPUDetails.

type CPUInfo

type CPUInfo struct {
	NUMANodeID    int
	SocketID      int
	CoreID        int
	UncoreCacheID int
}

CPUInfo contains the NUMA, socket, UncoreCache and core IDs associated with a CPU.

type CPUTopology

type CPUTopology struct {
	NumCPUs        int
	NumCores       int
	NumUncoreCache int
	NumSockets     int
	NumNUMANodes   int
	CPUDetails     CPUDetails
}

CPUTopology contains details of node cpu, where : CPU - logical CPU, cadvisor - thread Core - physical CPU, cadvisor - Core Socket - socket, cadvisor - Socket NUMA Node - NUMA cell, cadvisor - Node UncoreCache - Split L3 Cache Topology, cadvisor

func Discover

func Discover(machineInfo *cadvisorapi.MachineInfo) (*CPUTopology, error)

Discover returns CPUTopology based on cadvisor node info

func (*CPUTopology) CPUCoreID

func (topo *CPUTopology) CPUCoreID(cpu int) (int, error)

CPUCoreID returns the physical core ID which the given logical CPU belongs to.

func (*CPUTopology) CPUNUMANodeID

func (topo *CPUTopology) CPUNUMANodeID(cpu int) (int, error)

CPUCoreID returns the NUMA node ID which the given logical CPU belongs to.

func (*CPUTopology) CPUSocketID

func (topo *CPUTopology) CPUSocketID(cpu int) (int, error)

CPUCoreID returns the socket ID which the given logical CPU belongs to.

func (*CPUTopology) CPUsPerCore

func (topo *CPUTopology) CPUsPerCore() int

CPUsPerCore returns the number of logical CPUs are associated with each core.

func (*CPUTopology) CPUsPerSocket

func (topo *CPUTopology) CPUsPerSocket() int

CPUsPerSocket returns the number of logical CPUs are associated with each socket.

func (*CPUTopology) CPUsPerUncore

func (topo *CPUTopology) CPUsPerUncore() int

CPUsPerUncore returns the number of logicial CPUs that are associated with each UncoreCache

func (*CPUTopology) CheckAlignment

func (topo *CPUTopology) CheckAlignment(cpus cpuset.CPUSet) Alignment

CheckAlignment returns alignment information for the given cpuset in the context of the current CPU topology

type NUMANodeInfo

type NUMANodeInfo map[int]cpuset.CPUSet

NUMANodeInfo is a map from NUMANode ID to a list of CPU IDs associated with that NUMANode.

Source Files

alignment.go doc.go topology.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
3 hours ago

Tools for package owners.