Skip to content

Commit b86eb19

Browse files
committed
update comments
1 parent 3f459f2 commit b86eb19

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pkg/kubelet/cm/cpumanager/cpu_assignment.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,11 +561,12 @@ func (a *cpuAccumulator) takeFullUncore() {
561561
func (a *cpuAccumulator) takePartialUncore(uncoreID int) {
562562
numCoresNeeded := a.numCPUsNeeded / a.topo.CPUsPerCore()
563563

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

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

598+
// take partial UncoreCache if the CPUs needed is less than free UncoreCache size
597599
a.takePartialUncore(uncore)
598600
if a.isSatisfied() {
599601
return

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

Lines changed: 1 addition & 1 deletion
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)