Skip to content

Commit

Permalink
sched: Correct allocated resource accounting in spread assigner
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed May 23, 2022
1 parent fd8b91a commit f2c2993
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions extern/sector-storage/sched_assigner_spread.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ func SpreadWS(sh *Scheduler, queueLen int, acceptableWindows [][]int, windows []
scheduled := 0
rmQueue := make([]int, 0, queueLen)
workerAssigned := map[storiface.WorkerID]int{}

for sqi := 0; sqi < queueLen; sqi++ {
task := (*sh.SchedQueue)[sqi]

selectedWindow := -1
var needRes storiface.Resources
var info storiface.WorkerInfo
var bestWid storiface.WorkerID
bestAssigned := math.MaxInt // smaller = better

Expand All @@ -40,6 +43,8 @@ func SpreadWS(sh *Scheduler, queueLen int, acceptableWindows [][]int, windows []
continue
}

info = w.Info
needRes = res
bestWid = wid
selectedWindow = wnd
bestAssigned = wu
Expand All @@ -59,6 +64,7 @@ func SpreadWS(sh *Scheduler, queueLen int, acceptableWindows [][]int, windows []
"assigned", bestAssigned)

workerAssigned[bestWid]++
windows[selectedWindow].Allocated.Add(info.Resources, needRes)
windows[selectedWindow].Todo = append(windows[selectedWindow].Todo, task)

rmQueue = append(rmQueue, sqi)
Expand Down

0 comments on commit f2c2993

Please sign in to comment.