mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-22 10:06:15 +00:00
Fix bug in CPUManager map.Keys() and map.Values() implementations
Previously these would return lists that were too long because we appended to pre-initialized lists with a specific size. Since the primary place these functions are used is in the mean and standard deviation calculations for the NUMA distribution algorithm, it meant that the results of these calculations were often incorrect. As a result, some of the unit tests we have are actually incorrect (because the results we expect do not actually produce the best balanced distribution of CPUs across all NUMA nodes for the input provided). These tests will be patched up in subsequent commits. Signed-off-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
parent
446c58e0e7
commit
4008ea0b4c
@ -45,7 +45,7 @@ func (m mapIntInt) Clone() mapIntInt {
|
||||
}
|
||||
|
||||
func (m mapIntInt) Keys() []int {
|
||||
keys := make([]int, len(m))
|
||||
var keys []int
|
||||
for k := range m {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
@ -53,7 +53,7 @@ func (m mapIntInt) Keys() []int {
|
||||
}
|
||||
|
||||
func (m mapIntInt) Values() []int {
|
||||
values := make([]int, len(m))
|
||||
var values []int
|
||||
for _, v := range m {
|
||||
values = append(values, v)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user