]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove GODEBUG=gcrescanstacks=1 mode
authorAustin Clements <austin@google.com>
Thu, 16 Aug 2018 15:47:36 +0000 (11:47 -0400)
committerAustin Clements <austin@google.com>
Tue, 2 Oct 2018 20:35:27 +0000 (20:35 +0000)
Currently, setting GODEBUG=gcrescanstacks=1 enables a debugging mode
where the garbage collector re-scans goroutine stacks during mark
termination. This was introduced in Go 1.8 to debug the hybrid write
barrier, but I don't think we ever used it.

Now it's one of the last sources of mark work during mark termination.
This CL removes it.

Updates #26903. This is preparation for unifying STW GC and concurrent
GC.

Updates #17503.

Change-Id: I6ae04d3738aa9c448e6e206e21857a33ecd12acf
Reviewed-on: https://go-review.googlesource.com/c/134777
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/extern.go
src/runtime/mgc.go
src/runtime/mgcmark.go
src/runtime/runtime1.go

index 3be1eca09c0d9ada402e038fdcc248e9751a3ccb..640688e0049540bd5c7f60aa250da452cd9cb45e 100644 (file)
@@ -50,11 +50,6 @@ It is a comma-separated list of name=val pairs setting these named variables:
        gcshrinkstackoff: setting gcshrinkstackoff=1 disables moving goroutines
        onto smaller stacks. In this mode, a goroutine's stack can only grow.
 
-       gcrescanstacks: setting gcrescanstacks=1 enables stack
-       re-scanning during the STW mark termination phase. This is
-       helpful for debugging if objects are being prematurely
-       garbage collected.
-
        gcstoptheworld: setting gcstoptheworld=1 disables concurrent garbage collection,
        making every garbage collection a stop-the-world event. Setting gcstoptheworld=2
        also disables concurrent sweeping after the garbage collection finishes.
index 9ae5eb7a627d360a3ffa6b59b525b05765a1a2c6..b685415872d543f2361d3ea70f4dd2c2c1975e07 100644 (file)
@@ -1914,7 +1914,7 @@ func gcMark(start_time int64) {
                //
                // TODO(austin): Move STW marking out of
                // mark termination and eliminate this code path.
-               if debug.gcstoptheworld == 0 && debug.gcrescanstacks == 0 {
+               if debug.gcstoptheworld == 0 {
                        print("runtime: full=", hex(work.full), " nDataRoots=", work.nDataRoots, " nBSSRoots=", work.nBSSRoots, " nSpanRoots=", work.nSpanRoots, " nStackRoots=", work.nStackRoots, "\n")
                        panic("non-empty mark queue after concurrent mark")
                }
index b86b2d012e5f0ed21ab6705ff853fd4599d070e2..07b8f791d4e2aec35a11dd6d9e49641041a14701 100644 (file)
@@ -116,11 +116,6 @@ func gcMarkRootPrepare() {
                // contain pointers to unmarked objects, so on the
                // second markroot, there's no need to scan stacks.
                work.nStackRoots = 0
-
-               if debug.gcrescanstacks > 0 {
-                       // Scan stacks anyway for debugging.
-                       work.nStackRoots = int(atomic.Loaduintptr(&allglen))
-               }
        }
 
        work.markrootNext = 0
@@ -138,19 +133,10 @@ func gcMarkRootCheck() {
        lock(&allglock)
        // Check that stacks have been scanned.
        var gp *g
-       if gcphase == _GCmarktermination && debug.gcrescanstacks > 0 {
-               for i := 0; i < len(allgs); i++ {
-                       gp = allgs[i]
-                       if !(gp.gcscandone && gp.gcscanvalid) && readgstatus(gp) != _Gdead {
-                               goto fail
-                       }
-               }
-       } else {
-               for i := 0; i < work.nStackRoots; i++ {
-                       gp = allgs[i]
-                       if !gp.gcscandone {
-                               goto fail
-                       }
+       for i := 0; i < work.nStackRoots; i++ {
+               gp = allgs[i]
+               if !gp.gcscandone {
+                       goto fail
                }
        }
        unlock(&allglock)
index 85a9ba252197a305fb4918c6457303b8b5476b3c..8b8f4dcb1e98066269c4ce0dff642a3c45bf6b82 100644 (file)
@@ -305,7 +305,6 @@ var debug struct {
        gccheckmark        int32
        gcpacertrace       int32
        gcshrinkstackoff   int32
-       gcrescanstacks     int32
        gcstoptheworld     int32
        gctrace            int32
        invalidptr         int32
@@ -323,7 +322,6 @@ var dbgvars = []dbgVar{
        {"gccheckmark", &debug.gccheckmark},
        {"gcpacertrace", &debug.gcpacertrace},
        {"gcshrinkstackoff", &debug.gcshrinkstackoff},
-       {"gcrescanstacks", &debug.gcrescanstacks},
        {"gcstoptheworld", &debug.gcstoptheworld},
        {"gctrace", &debug.gctrace},
        {"invalidptr", &debug.invalidptr},