]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: add 'next' flag to ready
authorAustin Clements <austin@google.com>
Tue, 17 May 2016 22:21:54 +0000 (18:21 -0400)
committerAustin Clements <austin@google.com>
Thu, 19 May 2016 18:17:58 +0000 (18:17 +0000)
Currently ready always puts the readied goroutine in runnext. We're
going to have to change this for some uses, so add a flag for whether
or not to use runnext.

For now we always pass true so this is a no-op change.

For #15706.

Change-Id: Iaa66d8355ccfe4bbe347570cc1b1878c70fa25df
Reviewed-on: https://go-review.googlesource.com/23171
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/mgc.go
src/runtime/mgcmark.go
src/runtime/proc.go

index ae8338ac10bc030948ff6bff5761920d29a21b14..3d4df104cbae0b433e1f4d717c3f7ffd7c5ed944 100644 (file)
@@ -1704,7 +1704,7 @@ func gcSweep(mode gcMode) {
        lock(&sweep.lock)
        if sweep.parked {
                sweep.parked = false
-               ready(sweep.g, 0)
+               ready(sweep.g, 0, true)
        }
        unlock(&sweep.lock)
        mProf_GC()
index 5d947fb59e6d50b18bca5e89f9ff44ef850d11e3..dfddd8c6f6730b8fef1c49a04557fcd0a77bd4d0 100644 (file)
@@ -601,7 +601,7 @@ func gcFlushBgCredit(scanWork int64) {
                        gp.gcAssistBytes = 0
                        xgp := gp
                        gp = gp.schedlink.ptr()
-                       ready(xgp, 0)
+                       ready(xgp, 0, true)
                } else {
                        // Partially satisfy this assist.
                        gp.gcAssistBytes += scanBytes
index 15dcb95c9c6960c155e28ae73cd11d56eb9559eb..3a37fa947beeaa5a5771369ffafb79aa418a0126 100644 (file)
@@ -273,7 +273,7 @@ func goparkunlock(lock *mutex, reason string, traceEv byte, traceskip int) {
 
 func goready(gp *g, traceskip int) {
        systemstack(func() {
-               ready(gp, traceskip)
+               ready(gp, traceskip, true)
        })
 }
 
@@ -533,7 +533,7 @@ func mcommoninit(mp *m) {
 }
 
 // Mark gp ready to run.
-func ready(gp *g, traceskip int) {
+func ready(gp *g, traceskip int, next bool) {
        if trace.enabled {
                traceGoUnpark(gp, traceskip)
        }
@@ -550,7 +550,7 @@ func ready(gp *g, traceskip int) {
 
        // status is Gwaiting or Gscanwaiting, make Grunnable and put on runq
        casgstatus(gp, _Gwaiting, _Grunnable)
-       runqput(_g_.m.p.ptr(), gp, true)
+       runqput(_g_.m.p.ptr(), gp, next)
        if atomic.Load(&sched.npidle) != 0 && atomic.Load(&sched.nmspinning) == 0 { // TODO: fast atomic
                wakep()
        }
@@ -1835,7 +1835,7 @@ top:
        }
        if fingwait && fingwake {
                if gp := wakefing(); gp != nil {
-                       ready(gp, 0)
+                       ready(gp, 0, true)
                }
        }