diff options
| author | Austin Clements <austin@google.com> | 2015-10-23 15:55:03 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2015-11-05 21:23:27 +0000 |
| commit | a51905fa04fafaa8284d5a4585a81da249f9d8fd (patch) | |
| tree | 4e91efe48ea0f0d7778b4e5507cbb76673c581c7 /src/runtime/malloc.go | |
| parent | 9630c47e8c86a3fabc008eab9f239480b1d4f8e5 (diff) | |
| download | go-a51905fa04fafaa8284d5a4585a81da249f9d8fd.tar.xz | |
runtime: decentralize sweep termination and mark transition
This moves all of GC initialization, sweep termination, and the
transition to concurrent marking in to the off->mark transition
function. This means it's now handled on the goroutine that detected
the state exit condition.
As a result, malloc no longer needs to Gosched() at the beginning of
the GC cycle to prevent over-allocation while the GC is starting up
because it will now *help* the GC to start up. The Gosched hack is
still necessary during GC shutdown (this is easy to test by enabling
gctrace and hitting Ctrl-S to block the gctrace output).
At this point, the GC coordinator still handles later phases. This
requires a small tweak to how we start the GC coordinator. Currently,
starting the GC coordinator is best-effort and may fail if the
coordinator is about to park from the previous cycle but hasn't yet.
We fix this by replacing the park/ready to wake up the coordinator
with a semaphore. This is temporary since the coordinator will be
going away in a few commits.
Updates #11970.
Change-Id: I2c6a11c91e72dfbc59c2d8e7c66146dee9a444fe
Reviewed-on: https://go-review.googlesource.com/16357
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/malloc.go')
| -rw-r--r-- | src/runtime/malloc.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index 230849609f..45ebe712ba 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -737,7 +737,7 @@ func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer { 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 + // The GC shutting down, so we can't // assist, but we also can't allocate unabated. Slow // down this G's allocation and help the GC stay // scheduled by yielding. |
