From 91740582c3ec1e57621cbb0ec0f9163431f1b688 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Tue, 17 May 2016 18:21:54 -0400 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Rick Hudson --- src/runtime/mgc.go | 2 +- src/runtime/mgcmark.go | 2 +- src/runtime/proc.go | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index ae8338ac10b..3d4df104cba 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -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() diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go index 5d947fb59e6..dfddd8c6f67 100644 --- a/src/runtime/mgcmark.go +++ b/src/runtime/mgcmark.go @@ -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 diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 15dcb95c9c6..3a37fa947be 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -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) } }