aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/debugcall.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2022-08-31 18:21:48 +0000
committerGopher Robot <gobot@golang.org>2022-09-16 16:32:29 +0000
commit686b38b5b27fe14318adfee57aac780c452fddd6 (patch)
treecde4fef9ca40611f31ab85ae95f0cdf92cf812fa /src/runtime/debugcall.go
parenta2c396ce00df96f66246aab7a63f3ce5b7ad8753 (diff)
downloadgo-686b38b5b27fe14318adfee57aac780c452fddd6.tar.xz
runtime: set G wait reason more consistently
Currently, wait reasons are set somewhat inconsistently. In a follow-up CL, we're going to want to rely on the wait reason being there for casgstatus, so the status quo isn't really going to work for that. Plus this inconsistency means there are a whole bunch of cases where we could be more specific about the G's status but aren't. So, this change adds a new function, casGToWaiting which is like casgstatus but also sets the wait reason. The goal is that by using this API it'll be harder to forget to set a wait reason (or the lack thereof will at least be explicit). This change then updates all casgstatus(gp, ..., _Gwaiting) calls to casGToWaiting(gp, ..., waitReasonX) instead. For a number of these cases, we're missing a wait reason, and it wouldn't hurt to add a wait reason for them, so this change also adds those wait reasons. For #49881. Change-Id: Ia95e06ecb74ed17bb7bb94f1a362ebfe6bec1518 Reviewed-on: https://go-review.googlesource.com/c/go/+/427617 Reviewed-by: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Knyszek <mknyszek@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/runtime/debugcall.go')
-rw-r--r--src/runtime/debugcall.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/runtime/debugcall.go b/src/runtime/debugcall.go
index 2f164e7fd7..a4393b121a 100644
--- a/src/runtime/debugcall.go
+++ b/src/runtime/debugcall.go
@@ -158,11 +158,10 @@ func debugCallWrap(dispatch uintptr) {
gp.schedlink = 0
// Park the calling goroutine.
- gp.waitreason = waitReasonDebugCall
if trace.enabled {
traceGoPark(traceEvGoBlock, 1)
}
- casgstatus(gp, _Grunning, _Gwaiting)
+ casGToWaiting(gp, _Grunning, waitReasonDebugCall)
dropg()
// Directly execute the new goroutine. The debug