Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cherry pick some bugfix to release1.4 #1969

Merged
merged 2 commits into from
Jan 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 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 @@ -46,6 +47,7 @@ const (
)

type numaPlugin struct {
sync.Mutex
// Arguments given for the plugin
pluginArguments framework.Arguments
hintProviders []policy.HintProvider
Expand Down Expand Up @@ -143,6 +145,8 @@ func (pp *numaPlugin) OnSessionOpen(ssn *framework.Session) {
}
}

pp.Lock()
defer pp.Unlock()
if _, ok := pp.assignRes[task.UID]; !ok {
pp.assignRes[task.UID] = make(map[string]api.ResNumaSets)
}
Expand Down Expand Up @@ -225,9 +229,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