From: Austin Clements Date: Thu, 16 Aug 2018 15:47:36 +0000 (-0400) Subject: runtime: remove GODEBUG=gcrescanstacks=1 mode X-Git-Tag: go1.12beta1~944 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=198440cc3d3453d349fbc7894a5d91dd7b16e6a0;p=gostls13.git runtime: remove GODEBUG=gcrescanstacks=1 mode 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 TryBot-Result: Gobot Gobot Reviewed-by: Rick Hudson --- diff --git a/src/runtime/extern.go b/src/runtime/extern.go index 3be1eca09c..640688e004 100644 --- a/src/runtime/extern.go +++ b/src/runtime/extern.go @@ -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. diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index 9ae5eb7a62..b685415872 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -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") } diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go index b86b2d012e..07b8f791d4 100644 --- a/src/runtime/mgcmark.go +++ b/src/runtime/mgcmark.go @@ -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) diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go index 85a9ba2521..8b8f4dcb1e 100644 --- a/src/runtime/runtime1.go +++ b/src/runtime/runtime1.go @@ -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},