• Austin Clements's avatar
    runtime: assist harder if GC exceeds the estimated marked heap · 170fb100
    Austin Clements authored
    Currently, the GC controller computes the mutator assist ratio at the
    beginning of the cycle by estimating that the marked heap size this
    cycle will be the same as it was the previous cycle. It then uses that
    assist ratio for the rest of the cycle. However, this means that if
    the mutator is quickly growing its reachable heap, the heap size is
    likely to exceed the heap goal and currently there's no additional
    pressure on mutator assists when this happens. For example, 6g (with
    GOMAXPROCS=1) frequently exceeds the goal heap size by ~25% because of
    this.
    
    This change makes GC revise its work estimate and the resulting assist
    ratio every 10ms during the concurrent mark. Instead of
    unconditionally using the marked heap size from the last cycle as an
    estimate for this cycle, it takes the minimum of the previously marked
    heap and the currently marked heap. As a result, as the cycle
    approaches or exceeds its heap goal, this will increase the assist
    ratio to put more pressure on the mutator assist to bring the cycle to
    an end. For 6g, this causes the GC to always finish within 5% and
    often within 1% of its heap goal.
    
    Change-Id: I4333b92ad0878c704964be42c655c38a862b4224
    Reviewed-on: https://go-review.googlesource.com/9070Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
    Run-TryBot: Austin Clements <austin@google.com>
    170fb100
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...