Skip to content

Commit c52de76

Browse files
wongcharffromani
authored andcommitted
update comments
(cherry picked from commit b86eb19)
1 parent 46dc787 commit c52de76

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pkg/kubelet/cm/cpumanager/cpu_assignment.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,12 @@ func (a *cpuAccumulator) takeFullUncore() {
401401
func (a *cpuAccumulator) takePartialUncore(uncoreID int) {
402402
numCoresNeeded := a.numCPUsNeeded / a.topo.CPUsPerCore()
403403

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

409+
// claim the cpus if the free cpus within the UncoreCache can satisfy the needed cpus
409410
claimed := (a.numCPUsNeeded == freeCPUs.Size())
410411
klog.V(4).InfoS("takePartialUncore: trying to claim partial uncore",
411412
"uncore", uncoreID,
@@ -434,6 +435,7 @@ func (a *cpuAccumulator) takeUncoreCache() {
434435
return
435436
}
436437

438+
// take partial UncoreCache if the CPUs needed is less than free UncoreCache size
437439
a.takePartialUncore(uncore)
438440
if a.isSatisfied() {
439441
return

pkg/kubelet/cm/cpumanager/topology/topology.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (topo *CPUTopology) CPUNUMANodeID(cpu int) (int, error) {
101101
return info.NUMANodeID, nil
102102
}
103103

104-
// CPUInfo contains the NUMA, socket, unCoreCache and core IDs associated with a CPU.
104+
// CPUInfo contains the NUMA, socket, UncoreCache and core IDs associated with a CPU.
105105
type CPUInfo struct {
106106
NUMANodeID int
107107
SocketID int

0 commit comments

Comments
 (0)