]> Cypherpunks repositories - gostls13.git/commit
runtime: ensure minTriggerRatio never exceeds maxTriggerRatio
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 18 Mar 2020 15:09:40 +0000 (15:09 +0000)
committerMichael Knyszek <mknyszek@google.com>
Thu, 26 Mar 2020 16:12:18 +0000 (16:12 +0000)
commitd1ecfcc1e8baa0bb3a9fb504e8c14125a69139ba
treeea021ae7898e6937e928f35b2def55e1a0d101e1
parentb5f2c0f50297fa5cd14af668ddd7fd923626cf8c
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.

Fixes #37927.

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>
src/runtime/mgc.go