From 2755373470712775c73dc3f72557213cbe23fd0a Mon Sep 17 00:00:00 2001 From: Jun Gong Date: Wed, 20 Mar 2019 17:52:37 +0800 Subject: [PATCH] Avoid unnecessary sort for some cases in selectVictimsOnNode --- pkg/scheduler/core/generic_scheduler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/scheduler/core/generic_scheduler.go b/pkg/scheduler/core/generic_scheduler.go index 8875192db7..a43046c577 100644 --- a/pkg/scheduler/core/generic_scheduler.go +++ b/pkg/scheduler/core/generic_scheduler.go @@ -1070,7 +1070,6 @@ func selectVictimsOnNode( removePod(p) } } - potentialVictims.Sort() // If the new pod does not fit after removing all the lower priority pods, // we are almost done and this node is not suitable for preemption. The only // condition that we could check is if the "pod" is failing to schedule due to @@ -1085,6 +1084,7 @@ func selectVictimsOnNode( } var victims []*v1.Pod numViolatingVictim := 0 + potentialVictims.Sort() // Try to reprieve as many pods as possible. We first try to reprieve the PDB // violating victims and then other non-violating ones. In both cases, we start // from the highest priority victims.