Skip to content

Commit

Permalink
When the victim information is judged to be empty at one time, it doe…
Browse files Browse the repository at this point in the history
…s not necessarily prevent the scheduling of the preemptor task

Signed-off-by: wangyang <wangyang8126@gmail.com>
  • Loading branch information
wangyang0616 committed Apr 21, 2023
1 parent d4458ff commit 5939cc1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/scheduler/util/scheduler_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5939cc1

Please sign in to comment.