mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
Cleanup use of defaultAffinity in mergePermutation of TopologyManager
This commit is contained in:
parent
5e23517ebf
commit
94489c137c
@ -36,8 +36,8 @@ type Policy interface {
|
|||||||
func mergePermutation(numaNodes []int, permutation []TopologyHint) TopologyHint {
|
func mergePermutation(numaNodes []int, permutation []TopologyHint) TopologyHint {
|
||||||
// Get the NUMANodeAffinity from each hint in the permutation and see if any
|
// Get the NUMANodeAffinity from each hint in the permutation and see if any
|
||||||
// of them encode unpreferred allocations.
|
// of them encode unpreferred allocations.
|
||||||
defaultAffinity, _ := bitmask.NewBitMask(numaNodes...)
|
|
||||||
preferred := true
|
preferred := true
|
||||||
|
defaultAffinity, _ := bitmask.NewBitMask(numaNodes...)
|
||||||
var numaAffinities []bitmask.BitMask
|
var numaAffinities []bitmask.BitMask
|
||||||
for _, hint := range permutation {
|
for _, hint := range permutation {
|
||||||
// Only consider hints that have an actual NUMANodeAffinity set.
|
// Only consider hints that have an actual NUMANodeAffinity set.
|
||||||
@ -53,8 +53,7 @@ func mergePermutation(numaNodes []int, permutation []TopologyHint) TopologyHint
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Merge the affinities using a bitwise-and operation.
|
// Merge the affinities using a bitwise-and operation.
|
||||||
mergedAffinity, _ := bitmask.NewBitMask(numaNodes...)
|
mergedAffinity := bitmask.And(defaultAffinity, numaAffinities...)
|
||||||
mergedAffinity.And(numaAffinities...)
|
|
||||||
// Build a mergedHint from the merged affinity mask, indicating if an
|
// Build a mergedHint from the merged affinity mask, indicating if an
|
||||||
// preferred allocation was used to generate the affinity mask or not.
|
// preferred allocation was used to generate the affinity mask or not.
|
||||||
return TopologyHint{mergedAffinity, preferred}
|
return TopologyHint{mergedAffinity, preferred}
|
||||||
|
Loading…
Reference in New Issue
Block a user