• Austin Clements's avatar
    runtime: make gcSetTriggerRatio work at any time · 1c4f3c5e
    Austin Clements authored
    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: 's avatarRick Hudson <rlh@golang.org>
    1c4f3c5e
mgcsweep.go 12.9 KB