Skip to content

Commit

Permalink
try to fixed fatal error: concurrent map writes
Browse files Browse the repository at this point in the history
Signed-off-by: 刘毅(Jason Liu) <[email protected]>
  • Loading branch information
刘毅(Jason Liu) committed Nov 23, 2021
1 parent 55fb8c2 commit 4fec14b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/scheduler/plugins/numaaware/numaaware.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package numaaware
import (
"context"
"fmt"
"sync"

"volcano.sh/volcano/pkg/scheduler/plugins/util"

Expand Down Expand Up @@ -225,9 +226,12 @@ func filterNodeByPolicy(task *api.TaskInfo, node *api.NodeInfo, nodeResSets map[

func getNodeNumaNumForTask(nodeInfo []*api.NodeInfo, resAssignMap map[string]api.ResNumaSets) map[string]int64 {
nodeNumaNumMap := make(map[string]int64)
var mx sync.RWMutex
workqueue.ParallelizeUntil(context.TODO(), 16, len(nodeInfo), func(index int) {
node := nodeInfo[index]
assignCpus := resAssignMap[node.Name][string(v1.ResourceCPU)]
mx.Lock()
defer mx.Unlock()
nodeNumaNumMap[node.Name] = int64(getNumaNodeCntForcpuID(assignCpus, node.NumaSchedulerInfo.CPUDetail))
})

Expand Down

0 comments on commit 4fec14b

Please sign in to comment.