From f54bcedce19a2c5aed897a8697e65ba037a8f53d Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Fri, 23 Oct 2015 14:15:18 -0400 Subject: 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 Run-TryBot: Austin Clements --- src/runtime/malloc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/runtime/malloc.go') diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index 23c15da413..230849609f 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -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 -- cgit v1.3