diff options
| author | Michael Anthony Knyszek <mknyszek@google.com> | 2018-10-17 23:29:42 +0000 |
|---|---|---|
| committer | Michael Knyszek <mknyszek@google.com> | 2019-05-09 16:21:43 +0000 |
| commit | fe67ea32bf58fde5aae5609af12c71e547566513 (patch) | |
| tree | b2c9e1bf8b9169f0547e12e43039388b78748f5d /src/runtime/runtime2.go | |
| parent | eaa1c87b007ad4c19b09b5bd9fdd85a093075324 (diff) | |
| download | go-fe67ea32bf58fde5aae5609af12c71e547566513.tar.xz | |
runtime: add background scavenger
This change adds a background scavenging goroutine whose pacing is
determined when the heap goal changes. The scavenger is paced to use
at most 1% of the mutator's time for most systems. Furthermore, the
scavenger's pacing is computed based on the estimated number of
scavengable huge pages to take advantage of optimizations provided by
the OS.
The purpose of this scavenger is to deal with a shrinking heap: if the
heap goal is falling over time, the scavenger should kick in and start
returning free pages from the heap to the OS.
Also, now that we have a pacing system, the credit system used by
scavengeLocked has become redundant. Replace it with a mechanism which
only scavenges on the allocation path if it makes sense to do so with
respect to the new pacing system.
Fixes #30333.
Change-Id: I6203f8dc84affb26c3ab04528889dd9663530edc
Reviewed-on: https://go-review.googlesource.com/c/go/+/142960
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/runtime2.go')
| -rw-r--r-- | src/runtime/runtime2.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index fb607898c8..51bec24de5 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -852,6 +852,7 @@ const ( waitReasonSelectNoCases // "select (no cases)" waitReasonGCAssistWait // "GC assist wait" waitReasonGCSweepWait // "GC sweep wait" + waitReasonGCScavengeWait // "GC scavenge wait" waitReasonChanReceive // "chan receive" waitReasonChanSend // "chan send" waitReasonFinalizerWait // "finalizer wait" @@ -879,6 +880,7 @@ var waitReasonStrings = [...]string{ waitReasonSelectNoCases: "select (no cases)", waitReasonGCAssistWait: "GC assist wait", waitReasonGCSweepWait: "GC sweep wait", + waitReasonGCScavengeWait: "GC scavenge wait", waitReasonChanReceive: "chan receive", waitReasonChanSend: "chan send", waitReasonFinalizerWait: "finalizer wait", |
