]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.14] runtime: ensure minTriggerRatio never exceeds maxTriggerRatio
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 18 Mar 2020 15:09:40 +0000 (15:09 +0000)
committerIan Lance Taylor <iant@golang.org>
Fri, 27 Mar 2020 17:26:31 +0000 (17:26 +0000)
commit9d7dad18db88a666c6437917e26d18a167492302
treea830f5752625f3d4cd95cfd066b83fba6417745f
parent612ef03a232edcb43e2dff6943b2a8167647ba78
[release-branch.go1.14] runtime: ensure minTriggerRatio never exceeds maxTriggerRatio

Currently, the capping logic for the GC trigger ratio is such that if
gcpercent is low, we may end up setting the trigger ratio far too high,
breaking the promise of SetGCPercent and GOGC has a trade-off knob (we
won't start a GC early enough, and we will use more memory).

This change modifies the capping logic for the trigger ratio by scaling
the minTriggerRatio with gcpercent the same way we scale
maxTriggerRatio.

For #37927.
Fixes #37928.

Change-Id: I2a048c1808fb67186333d3d5a6bee328be2f35da
Reviewed-on: https://go-review.googlesource.com/c/go/+/223937
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
(cherry picked from commit d1ecfcc1e8baa0bb3a9fb504e8c14125a69139ba)
Reviewed-on: https://go-review.googlesource.com/c/go/+/225637
Reviewed-by: David Chase <drchase@google.com>
src/runtime/mgc.go