aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2024-01-29 23:57:14 +0000
committerGopher Robot <gobot@golang.org>2024-01-30 00:16:58 +0000
commit4afb155cdf5cd6e8b133174d3369c4db4ea23c77 (patch)
tree744951083379f67f4fa0e8893649980136d0b5c5 /src/runtime
parentf96d9a643202b9f28fad3756d0de8ac6b5c159dd (diff)
downloadgo-4afb155cdf5cd6e8b133174d3369c4db4ea23c77.tar.xz
Revert "runtime: disable use of runnext on wasm"
This reverts CL 557437. Reason for revert: Appears to have broken wasip1 builders. For #65178. Change-Id: I59c1a310eb56589c768536fe444c1efaf862f8b0 Reviewed-on: https://go-review.googlesource.com/c/go/+/559237 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/proc.go23
1 files changed, 2 insertions, 21 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 410bd01169..c1b3ce20d5 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -167,7 +167,7 @@ func main() {
// Allow newproc to start new Ms.
mainStarted = true
- if haveSysmon {
+ if GOARCH != "wasm" { // no threads on wasm yet, so no sysmon
systemstack(func() {
newm(sysmon, nil, -1)
})
@@ -5933,11 +5933,6 @@ var forcegcperiod int64 = 2 * 60 * 1e9
// golang.org/issue/42515 is needed on NetBSD.
var needSysmonWorkaround bool = false
-// haveSysmon indicates whether there is sysmon thread support.
-//
-// No threads on wasm yet, so no sysmon.
-const haveSysmon = GOARCH != "wasm"
-
// Always runs without a P, so write barriers are not allowed.
//
//go:nowritebarrierrec
@@ -6118,10 +6113,7 @@ func retake(now int64) uint32 {
s := pp.status
sysretake := false
if s == _Prunning || s == _Psyscall {
- // Preempt G if it's running on the same schedtick for
- // too long. This could be from a single long-running
- // goroutine or a sequence of goroutines run via
- // runnext, which share a single schedtick time slice.
+ // Preempt G if it's running for too long.
t := int64(pp.schedtick)
if int64(pd.schedtick) != t {
pd.schedtick = uint32(t)
@@ -6632,17 +6624,6 @@ const randomizeScheduler = raceenabled
// If the run queue is full, runnext puts g on the global queue.
// Executed only by the owner P.
func runqput(pp *p, gp *g, next bool) {
- if !haveSysmon && next {
- // A runnext goroutine shares the same time slice as the
- // current goroutine (inheritTime from runqget). To prevent a
- // ping-pong pair of goroutines from starving all others, we
- // depend on sysmon to preempt "long-running goroutines". That
- // is, any set of goroutines sharing the same time slice.
- //
- // If there is no sysmon, we must avoid runnext entirely or
- // risk starvation.
- next = false
- }
if randomizeScheduler && next && randn(2) == 0 {
next = false
}