mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-21 01:26:28 +00:00
update comments
This commit is contained in:
parent
3f459f20d6
commit
b86eb19d30
@ -561,11 +561,12 @@ func (a *cpuAccumulator) takeFullUncore() {
|
|||||||
func (a *cpuAccumulator) takePartialUncore(uncoreID int) {
|
func (a *cpuAccumulator) takePartialUncore(uncoreID int) {
|
||||||
numCoresNeeded := a.numCPUsNeeded / a.topo.CPUsPerCore()
|
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
|
// determine the N number of free cores (physical cpus) within the UncoreCache, then
|
||||||
// cpus (virtual cpus). Taking directly the first M cpus (virtual cpus) leads to suboptimal allocation
|
// determine the M number of free cpus (virtual cpus) that correspond with the free cores
|
||||||
freeCores := a.details.CoresNeededInUncoreCache(numCoresNeeded, uncoreID)
|
freeCores := a.details.CoresNeededInUncoreCache(numCoresNeeded, uncoreID)
|
||||||
freeCPUs := a.details.CPUsInCores(freeCores.UnsortedList()...)
|
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())
|
claimed := (a.numCPUsNeeded == freeCPUs.Size())
|
||||||
klog.V(4).InfoS("takePartialUncore: trying to claim partial uncore",
|
klog.V(4).InfoS("takePartialUncore: trying to claim partial uncore",
|
||||||
"uncore", uncoreID,
|
"uncore", uncoreID,
|
||||||
@ -594,6 +595,7 @@ func (a *cpuAccumulator) takeUncoreCache() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// take partial UncoreCache if the CPUs needed is less than free UncoreCache size
|
||||||
a.takePartialUncore(uncore)
|
a.takePartialUncore(uncore)
|
||||||
if a.isSatisfied() {
|
if a.isSatisfied() {
|
||||||
return
|
return
|
||||||
|
@ -101,7 +101,7 @@ func (topo *CPUTopology) CPUNUMANodeID(cpu int) (int, error) {
|
|||||||
return info.NUMANodeID, nil
|
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 {
|
type CPUInfo struct {
|
||||||
NUMANodeID int
|
NUMANodeID int
|
||||||
SocketID int
|
SocketID int
|
||||||
|
Loading…
Reference in New Issue
Block a user