Commit 4a7d5aa3 authored by Austin Clements's avatar Austin Clements

runtime: don't use GOGC in minimum sweep distance

Currently, the minimum sweep distance is 1MB * GOGC/100. It's been
this way since it was introduced in CL 13043 with no justification.

Since there seems to be no good reason to scale the minimum sweep
distance by GOGC, make the minimum sweep distance just 1MB.

Change-Id: I5320574a23c0eec641e346282aab08a3bbb057da
Reviewed-on: https://go-review.googlesource.com/c/go/+/66091
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarMichael Knyszek <mknyszek@google.com>
Reviewed-by: default avatarRick Hudson <rlh@golang.org>
parent 7da03b9f
...@@ -141,7 +141,7 @@ const ( ...@@ -141,7 +141,7 @@ const (
// sweepMinHeapDistance is a lower bound on the heap distance // sweepMinHeapDistance is a lower bound on the heap distance
// (in bytes) reserved for concurrent sweeping between GC // (in bytes) reserved for concurrent sweeping between GC
// cycles. This will be scaled by gcpercent/100. // cycles.
sweepMinHeapDistance = 1024 * 1024 sweepMinHeapDistance = 1024 * 1024
) )
...@@ -803,7 +803,7 @@ func gcSetTriggerRatio(triggerRatio float64) { ...@@ -803,7 +803,7 @@ func gcSetTriggerRatio(triggerRatio float64) {
// that concurrent sweep has some heap growth // that concurrent sweep has some heap growth
// in which to perform sweeping before we // in which to perform sweeping before we
// start the next GC cycle. // start the next GC cycle.
sweepMin := atomic.Load64(&memstats.heap_live) + sweepMinHeapDistance*uint64(gcpercent)/100 sweepMin := atomic.Load64(&memstats.heap_live) + sweepMinHeapDistance
if sweepMin > minTrigger { if sweepMin > minTrigger {
minTrigger = sweepMin minTrigger = sweepMin
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment