Don't lock activeQ twice when activating pod in scheduling queue

This commit is contained in:
Maciej Skoczeń 2024-07-19 09:18:42 +00:00
parent 77e12aeca9
commit 7421ded6f9

View File

@ -660,17 +660,12 @@ func (p *PriorityQueue) existsInActiveQ(pInfo *framework.QueuedPodInfo) bool {
}
func (p *PriorityQueue) activate(logger klog.Logger, pod *v1.Pod) bool {
// Verify if the pod is present in activeQ.
if p.existsInActiveQ(newQueuedPodInfoForLookup(pod)) {
// No need to activate if it's already present in activeQ.
return false
}
var pInfo *framework.QueuedPodInfo
// Verify if the pod is present in unschedulablePods or backoffQ.
if pInfo = p.unschedulablePods.get(pod); pInfo == nil {
// If the pod doesn't belong to unschedulablePods or backoffQ, don't activate it.
// The pod can be already in activeQ.
if obj, exists, _ := p.podBackoffQ.Get(newQueuedPodInfoForLookup(pod)); !exists {
logger.Error(nil, "To-activate pod does not exist in unschedulablePods or backoffQ", "pod", klog.KObj(pod))
return false
} else {
pInfo = obj.(*framework.QueuedPodInfo)