aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/proc.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/proc.go')
-rw-r--r--src/runtime/proc.go21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 035822216d..5e38b3194c 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -5,6 +5,7 @@
package runtime
import (
+ "internal/bytealg"
"internal/cpu"
"runtime/internal/atomic"
"runtime/internal/sys"
@@ -557,7 +558,6 @@ func schedinit() {
sched.maxmcount = 10000
- tracebackinit()
moduledataverify()
stackinit()
mallocinit()
@@ -2575,15 +2575,20 @@ func injectglist(glist *gList) {
return
}
- lock(&sched.lock)
- npidle := int(sched.npidle)
+ npidle := int(atomic.Load(&sched.npidle))
+ var globq gQueue
var n int
for n = 0; n < npidle && !q.empty(); n++ {
- globrunqput(q.pop())
+ g := q.pop()
+ globq.pushBack(g)
+ }
+ if n > 0 {
+ lock(&sched.lock)
+ globrunqputbatch(&globq, int32(n))
+ unlock(&sched.lock)
+ startIdle(n)
+ qsize -= n
}
- unlock(&sched.lock)
- startIdle(n)
- qsize -= n
if !q.empty() {
runqputbatch(pp, &q, qsize)
@@ -5460,7 +5465,7 @@ func haveexperiment(name string) bool {
x := sys.Goexperiment
for x != "" {
xname := ""
- i := index(x, ",")
+ i := bytealg.IndexByteString(x, ',')
if i < 0 {
xname, x = x, ""
} else {