Skip to content

Commit 9174058

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Rick Hudson <[email protected]>
1 parent 79ba1e4 commit 9174058

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/runtime/mgc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1704,7 +1704,7 @@ func gcSweep(mode gcMode) {
17041704
lock(&sweep.lock)
17051705
if sweep.parked {
17061706
sweep.parked = false
1707-
ready(sweep.g, 0)
1707+
ready(sweep.g, 0, true)
17081708
}
17091709
unlock(&sweep.lock)
17101710
mProf_GC()

src/runtime/mgcmark.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ func gcFlushBgCredit(scanWork int64) {
601601
gp.gcAssistBytes = 0
602602
xgp := gp
603603
gp = gp.schedlink.ptr()
604-
ready(xgp, 0)
604+
ready(xgp, 0, true)
605605
} else {
606606
// Partially satisfy this assist.
607607
gp.gcAssistBytes += scanBytes

src/runtime/proc.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func goparkunlock(lock *mutex, reason string, traceEv byte, traceskip int) {
273273

274274
func goready(gp *g, traceskip int) {
275275
systemstack(func() {
276-
ready(gp, traceskip)
276+
ready(gp, traceskip, true)
277277
})
278278
}
279279

@@ -533,7 +533,7 @@ func mcommoninit(mp *m) {
533533
}
534534

535535
// Mark gp ready to run.
536-
func ready(gp *g, traceskip int) {
536+
func ready(gp *g, traceskip int, next bool) {
537537
if trace.enabled {
538538
traceGoUnpark(gp, traceskip)
539539
}
@@ -550,7 +550,7 @@ func ready(gp *g, traceskip int) {
550550

551551
// status is Gwaiting or Gscanwaiting, make Grunnable and put on runq
552552
casgstatus(gp, _Gwaiting, _Grunnable)
553-
runqput(_g_.m.p.ptr(), gp, true)
553+
runqput(_g_.m.p.ptr(), gp, next)
554554
if atomic.Load(&sched.npidle) != 0 && atomic.Load(&sched.nmspinning) == 0 { // TODO: fast atomic
555555
wakep()
556556
}
@@ -1835,7 +1835,7 @@ top:
18351835
}
18361836
if fingwait && fingwake {
18371837
if gp := wakefing(); gp != nil {
1838-
ready(gp, 0)
1838+
ready(gp, 0, true)
18391839
}
18401840
}
18411841

0 commit comments

Comments
 (0)