diff options
| author | Cherry Zhang <cherryyz@google.com> | 2020-08-21 14:18:06 -0400 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2020-08-21 14:18:06 -0400 |
| commit | 0ef562592fe05b50b0ae8fce495ee7e2eec791f0 (patch) | |
| tree | d1c0f668e473ebdcb4a30e190008043bdb223bd9 /src/runtime/proc.go | |
| parent | ac5c406ef0ab20e2a11f57470271266ef4265221 (diff) | |
| parent | 9679b307334bce77cc6e50751956a4c717e9458c (diff) | |
| download | go-0ef562592fe05b50b0ae8fce495ee7e2eec791f0.tar.xz | |
[dev.link] all: merge branch 'master' into dev.link
Change-Id: Ic66b5138f3ecd9e9a48d7ab05782297c06e4a5b5
Diffstat (limited to 'src/runtime/proc.go')
| -rw-r--r-- | src/runtime/proc.go | 21 |
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 { |
