From 5939cc189ba027453b2d094cb6117324c0360e11 Mon Sep 17 00:00:00 2001 From: wangyang Date: Tue, 11 Apr 2023 20:35:00 +0800 Subject: [PATCH] When the victim information is judged to be empty at one time, it does not necessarily prevent the scheduling of the preemptor task Signed-off-by: wangyang --- pkg/scheduler/util/scheduler_helper.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/scheduler/util/scheduler_helper.go b/pkg/scheduler/util/scheduler_helper.go index 01a69e7160..29252e18cf 100644 --- a/pkg/scheduler/util/scheduler_helper.go +++ b/pkg/scheduler/util/scheduler_helper.go @@ -172,9 +172,10 @@ func GetNodeList(nodes map[string]*api.NodeInfo, nodeList []string) []*api.NodeI // ValidateVictims returns an error if the resources of the victims can't satisfy the preemptor func ValidateVictims(preemptor *api.TaskInfo, node *api.NodeInfo, victims []*api.TaskInfo) error { - if len(victims) == 0 { - return fmt.Errorf("no victims") - } + // Victims should not be judged to be empty here. + // It is possible to complete the scheduling of the preemptor without evicting the task. + // In the first round, a large task (CPU: 8) is expelled, and a small task is scheduled (CPU: 2) + // When the following rounds of victims are empty, it is still allowed to schedule small tasks (CPU: 2) futureIdle := node.FutureIdle() for _, victim := range victims { futureIdle.Add(victim.Resreq)