mirror of
https://github.com/golang/go.git
synced 2025-10-29 07:44:14 +00:00
runtime: beginning of decentralized off->mark transition
This begins the conversion of the centralized GC coordinator to a decentralized state machine by introducing the internal API that triggers the first state transition from _GCoff to _GCmark (or _GCmarktermination). This change introduces the transition lock, the off->mark transition condition (which is very similar to shouldtriggergc()), and the general structure of a state transition. Since we're doing this conversion in stages, it then falls back to the GC coordinator to actually execute the cycle. We'll start moving logic out of the GC coordinator and in to transition functions next. This fixes a minor bug in gcstoptheworld debug mode where passing the heap trigger once could trigger multiple STW GCs. Updates #11970. Change-Id: I964087dd190a639eb5766398f8e1bbf8b352902f Reviewed-on: https://go-review.googlesource.com/16355 Reviewed-by: Rick Hudson <rlh@golang.org> Run-TryBot: Austin Clements <austin@google.com>
This commit is contained in:
parent
3842596284
commit
f54bcedce1
5 changed files with 98 additions and 54 deletions
|
|
@ -734,8 +734,8 @@ func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer {
|
|||
assistG.gcAssistBytes -= int64(size - dataSize)
|
||||
}
|
||||
|
||||
if shouldhelpgc && shouldtriggergc() {
|
||||
startGC(gcBackgroundMode, false)
|
||||
if shouldhelpgc && gcShouldStart(false) {
|
||||
gcStart(gcBackgroundMode, false)
|
||||
} else if shouldhelpgc && bggc.working != 0 && gcBlackenEnabled == 0 {
|
||||
// The GC is starting up or shutting down, so we can't
|
||||
// assist, but we also can't allocate unabated. Slow
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue