mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Ensure we balance across *all* NUMA nodes in NUMA distribution algo
Signed-off-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
parent
c8559bc43e
commit
446c58e0e7
@ -605,13 +605,16 @@ func takeByTopologyNUMADistributed(topo *topology.CPUTopology, availableCPUs cpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate how many CPUs will be available on each NUMA node in
|
// Calculate how many CPUs will be available on each NUMA node in
|
||||||
// 'combo' after allocating an even distribution of CPU groups of
|
// the system after allocating an even distribution of CPU groups
|
||||||
// size 'cpuGroupSize' from them. This will be used in the "balance
|
// of size 'cpuGroupSize' from each NUMA node in 'combo'. This will
|
||||||
// score" calculation to help decide if this combo should
|
// be used in the "balance score" calculation to help decide if
|
||||||
// ultimately be chosen.
|
// this combo should ultimately be chosen.
|
||||||
availableAfterAllocation := make(mapIntInt, len(combo))
|
availableAfterAllocation := make(mapIntInt, len(numas))
|
||||||
|
for _, numa := range numas {
|
||||||
|
availableAfterAllocation[numa] = acc.details.CPUsInNUMANodes(numa).Size()
|
||||||
|
}
|
||||||
for _, numa := range combo {
|
for _, numa := range combo {
|
||||||
availableAfterAllocation[numa] = acc.details.CPUsInNUMANodes(numa).Size() - distribution
|
availableAfterAllocation[numa] -= distribution
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if there are any remaining CPUs to distribute across the
|
// Check if there are any remaining CPUs to distribute across the
|
||||||
@ -648,7 +651,7 @@ func takeByTopologyNUMADistributed(topo *topology.CPUTopology, availableCPUs cpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the "balance score" as the standard deviation of
|
// Calculate the "balance score" as the standard deviation of
|
||||||
// the number of CPUs available on all NUMA nodes in 'combo'
|
// the number of CPUs available on all NUMA nodes in the system
|
||||||
// after the remainder CPUs have been allocated across 'subset'
|
// after the remainder CPUs have been allocated across 'subset'
|
||||||
// in groups of size 'cpuGroupSize'.
|
// in groups of size 'cpuGroupSize'.
|
||||||
balance := standardDeviation(availableAfterAllocation.Values())
|
balance := standardDeviation(availableAfterAllocation.Values())
|
||||||
|
Loading…
Reference in New Issue
Block a user