]> Cypherpunks repositories - gostls13.git/commit
runtime: make gcSetTriggerRatio work at any time
authorAustin Clements <austin@google.com>
Mon, 3 Apr 2017 19:47:11 +0000 (15:47 -0400)
committerAustin Clements <austin@google.com>
Fri, 21 Apr 2017 17:41:59 +0000 (17:41 +0000)
commit1c4f3c5ea0267e8ebc990ee67c09efa01cb59746
treed515f87144d043e91ec7c77c1f59ac4091fcfa07
parenta5eb3dceaf8d4e3fafac0d947decae62d3028df1
runtime: make gcSetTriggerRatio work at any time

This changes gcSetTriggerRatio so it can be called even during
concurrent mark or sweep. In this case, it will adjust the pacing of
the current phase, accounting for progress that has already been made.

To make this work for concurrent sweep, this introduces a "basis" for
the pagesSwept count, much like the basis we just introduced for
heap_live. This lets gcSetTriggerRatio shift the basis to the current
heap_live and pagesSwept and compute a slope from there to completion.
This avoids creating a discontinuity where, if the ratio has
increased, there has to be a flurry of sweep activity to catch up.
Instead, this creates a continuous, piece-wise linear function as
adjustments are made.

For #19076.

Change-Id: Ibcd76aeeb81ff4814b00be7cbd3530b73bbdbba9
Reviewed-on: https://go-review.googlesource.com/39833
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/mgc.go
src/runtime/mgcsweep.go
src/runtime/mheap.go