Skip to content

Commit

Permalink
UPSTREAM: 126750: update comments
Browse files Browse the repository at this point in the history
(cherry picked from commit b86eb19)
  • Loading branch information
wongchar authored and ffromani committed Nov 20, 2024
1 parent 90bddf5 commit fa8e99e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pkg/kubelet/cm/cpumanager/cpu_assignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,12 @@ func (a *cpuAccumulator) takeFullUncore() {
func (a *cpuAccumulator) takePartialUncore(uncoreID int) {
numCoresNeeded := a.numCPUsNeeded / a.topo.CPUsPerCore()

// note: we need to keep the first N free cores (physical cpus) and only we we got these expand to their
// cpus (virtual cpus). Taking directly the first M cpus (virtual cpus) leads to suboptimal allocation
// determine the N number of free cores (physical cpus) within the UncoreCache, then
// determine the M number of free cpus (virtual cpus) that correspond with the free cores
freeCores := a.details.CoresNeededInUncoreCache(numCoresNeeded, uncoreID)
freeCPUs := a.details.CPUsInCores(freeCores.UnsortedList()...)

// claim the cpus if the free cpus within the UncoreCache can satisfy the needed cpus
claimed := (a.numCPUsNeeded == freeCPUs.Size())
klog.V(4).InfoS("takePartialUncore: trying to claim partial uncore",
"uncore", uncoreID,
Expand Down Expand Up @@ -594,6 +595,7 @@ func (a *cpuAccumulator) takeUncoreCache() {
return
}

// take partial UncoreCache if the CPUs needed is less than free UncoreCache size
a.takePartialUncore(uncore)
if a.isSatisfied() {
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubelet/cm/cpumanager/topology/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (topo *CPUTopology) CPUNUMANodeID(cpu int) (int, error) {
return info.NUMANodeID, nil
}

// CPUInfo contains the NUMA, socket, unCoreCache and core IDs associated with a CPU.
// CPUInfo contains the NUMA, socket, UncoreCache and core IDs associated with a CPU.
type CPUInfo struct {
NUMANodeID int
SocketID int
Expand Down

0 comments on commit fa8e99e

Please sign in to comment.