Skip to content

Commit

Permalink
runtime: remove GODEBUG=gctrace=2 mode
Browse files Browse the repository at this point in the history
It turns out if you set GODEBUG=gctrace=2, it enables an obscure
debugging mode that, in addition to printing gctrace statistics, also
does a second STW GC following each regular GC. This debugging mode
has long since lost its value (you could maybe use it to analyze
floating garbage, except that we don't print the gctrace line on the
second GC), and it interferes substantially with the operation of the
GC by messing up the statistics used to schedule GCs.

It's also a source of mark termination GC work when we're in
concurrent GC mode, so it's going to interfere with eliminating mark
2. And it's going to get in the way of unifying STW and concurrent GC.

This CL removes this debugging mode.

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

Change-Id: Ib5bce05d8c4d5b6559c89a65165d49532165df07
Reviewed-on: https://go-review.googlesource.com/c/134316
Run-TryBot: Austin Clements <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Rick Hudson <[email protected]>
  • Loading branch information
aclements committed Oct 2, 2018
1 parent 9c634ea commit edc2d17
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
3 changes: 1 addition & 2 deletions src/runtime/extern.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ It is a comma-separated list of name=val pairs setting these named variables:
gctrace: setting gctrace=1 causes the garbage collector to emit a single line to standard
error at each collection, summarizing the amount of memory collected and the
length of the pause. Setting gctrace=2 emits the same summary but also
repeats each collection. The format of this line is subject to change.
length of the pause. The format of this line is subject to change.
Currently, it is:
gc # @#s #%: #+#+# ms clock, #+#/#/#+# ms cpu, #->#-># MB, # MB goal, # P
where the fields are as follows:
Expand Down
17 changes: 0 additions & 17 deletions src/runtime/mgc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1558,23 +1558,6 @@ func gcMarkTermination(nextTriggerRatio float64) {
// marking is complete so we can turn the write barrier off
setGCPhase(_GCoff)
gcSweep(work.mode)

if debug.gctrace > 1 {
startTime = nanotime()
// The g stacks have been scanned so
// they have gcscanvalid==true and gcworkdone==true.
// Reset these so that all stacks will be rescanned.
gcResetMarkState()
finishsweep_m()

// Still in STW but gcphase is _GCoff, reset to _GCmarktermination
// At this point all objects will be found during the gcMark which
// does a complete STW mark and object scan.
setGCPhase(_GCmarktermination)
gcMark(startTime)
setGCPhase(_GCoff) // marking is done, turn off wb.
gcSweep(work.mode)
}
})

_g_.m.traceback = 0
Expand Down

0 comments on commit edc2d17

Please sign in to comment.