From: Austin Clements Date: Mon, 25 Sep 2017 19:17:28 +0000 (-0400) Subject: runtime: don't use GOGC in minimum sweep distance X-Git-Tag: go1.13beta1~1203 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4a7d5aa30bab454f546d8f3b6d4b4a27585f1433;p=gostls13.git 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 TryBot-Result: Gobot Gobot Reviewed-by: Michael Knyszek Reviewed-by: Rick Hudson --- diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index 730b64cd19..023ab2f6ea 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -141,7 +141,7 @@ const ( // sweepMinHeapDistance is a lower bound on the heap distance // (in bytes) reserved for concurrent sweeping between GC - // cycles. This will be scaled by gcpercent/100. + // cycles. sweepMinHeapDistance = 1024 * 1024 ) @@ -803,7 +803,7 @@ func gcSetTriggerRatio(triggerRatio float64) { // that concurrent sweep has some heap growth // in which to perform sweeping before we // 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 { minTrigger = sweepMin }