aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/traceback.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2018-08-13 16:08:03 -0400
committerAustin Clements <austin@google.com>2018-10-02 20:35:28 +0000
commit29b21ec4c371061a99dfaac356e54b3c62c5853f (patch)
treebb3ad71ff934461c715b0c9924bd411c816c55b8 /src/runtime/traceback.go
parent198440cc3d3453d349fbc7894a5d91dd7b16e6a0 (diff)
downloadgo-29b21ec4c371061a99dfaac356e54b3c62c5853f.tar.gz
go-29b21ec4c371061a99dfaac356e54b3c62c5853f.zip
runtime: add a more stable isSystemGoroutine mode
Currently, isSystemGoroutine varies on whether it considers the finalizer goroutine a user goroutine or a system goroutine. For the next CL, we're going to want to always consider the finalier goroutine a user goroutine, so add a flag that indicates that. Updates #26903. This is preparation for unifying STW GC and concurrent GC. Change-Id: Iafc92e519c13d9f8d879332cb5f0d12164104c33 Reviewed-on: https://go-review.googlesource.com/c/134778 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime/traceback.go')
-rw-r--r--src/runtime/traceback.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go
index 8e104ae89e7..69d5764c8f7 100644
--- a/src/runtime/traceback.go
+++ b/src/runtime/traceback.go
@@ -945,7 +945,7 @@ func tracebackothers(me *g) {
lock(&allglock)
for _, gp := range allgs {
- if gp == me || gp == g.m.curg || readgstatus(gp) == _Gdead || isSystemGoroutine(gp) && level < 2 {
+ if gp == me || gp == g.m.curg || readgstatus(gp) == _Gdead || isSystemGoroutine(gp, false) && level < 2 {
continue
}
print("\n")
@@ -1031,7 +1031,11 @@ func topofstack(f funcInfo, g0 bool) bool {
// in stack dumps and deadlock detector. This is any goroutine that
// starts at a runtime.* entry point, except for runtime.main and
// sometimes runtime.runfinq.
-func isSystemGoroutine(gp *g) bool {
+//
+// If fixed is true, any goroutine that can vary between user and
+// system (that is, the finalizer goroutine) is considered a user
+// goroutine.
+func isSystemGoroutine(gp *g, fixed bool) bool {
// Keep this in sync with cmd/trace/trace.go:isSystemGoroutine.
f := findfunc(gp.startpc)
if !f.valid() {
@@ -1043,6 +1047,11 @@ func isSystemGoroutine(gp *g) bool {
if f.funcID == funcID_runfinq {
// We include the finalizer goroutine if it's calling
// back into user code.
+ if fixed {
+ // This goroutine can vary. In fixed mode,
+ // always consider it a user goroutine.
+ return false
+ }
return !fingRunning
}
return hasPrefix(funcname(f), "runtime.")