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:
parent
79ba1e44c7
commit
91740582c3
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user