1
0
mirror of https://github.com/golang/go synced 2024-11-23 16:20:04 -07:00

runtime: add 'next' flag to ready

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>
This commit is contained in:
Austin Clements 2016-05-17 18:21:54 -04:00
parent 79ba1e44c7
commit 91740582c3
3 changed files with 6 additions and 6 deletions

View 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()

View 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

View 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)
}
}