Skip to content

Commit c5c1955

Browse files
committed
runtime: break out new minimum heap size into a goexperiment
The new minimum heap of 512 KiB has been the cause of some build slowdown (~1%) and microbenchmark slowdown (usually ~0%, up to ~50%) because of two reasons: 1. Applications with lots of small short-lived processes execute many more GC cycles. 2. Applications with heaps <4 MiB GC up to 8x more often. In many ways these consequences are inevitable given how GOGC works, however we need to investigate more as to whether the apparent slowdowns are indeed unavoidable or if the GC has issues scaling down, which it's too late for for this release. Given that this release is already huge, it's OK to push this back. We'll take a closer look at it next cycle, so place block it behind a new goexperiment to allow users and ourselves to easily experiment with it. Fixes #49744. Updates #44167. Change-Id: Ibad51f7873de7517490c89802f3c593834e77ff0 Reviewed-on: https://go-review.googlesource.com/c/go/+/368137 Trust: Michael Knyszek <[email protected]> Run-TryBot: Michael Knyszek <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Austin Clements <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent 36be0be commit c5c1955

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

src/internal/goexperiment/exp_heapminimum512kib_off.go

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/internal/goexperiment/exp_heapminimum512kib_on.go

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/internal/goexperiment/flags.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,11 @@ type Flags struct {
8989
// Details regarding the new pacer may be found at
9090
// https://golang.org/design/44167-gc-pacer-redesign
9191
PacerRedesign bool
92+
93+
// HeapMinimum512KiB reduces the minimum heap size to 512 KiB.
94+
//
95+
// This was originally reduced as part of PacerRedesign, but
96+
// has been broken out to its own experiment that is disabled
97+
// by default.
98+
HeapMinimum512KiB bool
9299
}

src/runtime/mgcpacer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ const (
5353
gcOverAssistWork = 64 << 10
5454

5555
// defaultHeapMinimum is the value of heapMinimum for GOGC==100.
56-
defaultHeapMinimum = goexperiment.PacerRedesignInt*(512<<10) +
57-
(1-goexperiment.PacerRedesignInt)*(4<<20)
56+
defaultHeapMinimum = (goexperiment.HeapMinimum512KiBInt)*(512<<10) +
57+
(1-goexperiment.HeapMinimum512KiBInt)*(4<<20)
5858

5959
// scannableStackSizeSlack is the bytes of stack space allocated or freed
6060
// that can accumulate on a P before updating gcController.stackSize.

0 commit comments

Comments
 (0)