Skip to content

Commit 26cb650

Browse files
committed
Remove unnecessary union after call to GetPreferredAllocation()
There is no need to try and allocate already-allocated devices again.
1 parent 67ecc11 commit 26cb650

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/kubelet/cm/devicemanager/manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ func (m *ManagerImpl) devicesToAllocate(podUID, contName, resource string, requi
709709
if err != nil {
710710
return nil, err
711711
}
712-
if allocateRemainingFrom(preferred.Intersection(aligned.Union(allocated))) {
712+
if allocateRemainingFrom(preferred.Intersection(aligned)) {
713713
return allocated, nil
714714
}
715715
// Then fallback to allocate from the aligned set if no preferred list
@@ -734,7 +734,7 @@ func (m *ManagerImpl) devicesToAllocate(podUID, contName, resource string, requi
734734
if err != nil {
735735
return nil, err
736736
}
737-
if allocateRemainingFrom(preferred.Intersection(available.Union(allocated))) {
737+
if allocateRemainingFrom(preferred.Intersection(available)) {
738738
return allocated, nil
739739
}
740740

0 commit comments

Comments
 (0)