]> Cypherpunks repositories - gostls13.git/commit
runtime: assist harder if GC exceeds the estimated marked heap
authorAustin Clements <austin@google.com>
Fri, 17 Apr 2015 20:26:55 +0000 (16:26 -0400)
committerAustin Clements <austin@google.com>
Tue, 21 Apr 2015 15:35:55 +0000 (15:35 +0000)
commit170fb100891fff56529b6816ab581af19a717fa9
tree702ec6a2888bf245e86ee59da9dcdfbd0766cfd8
parente0c3d85f08431540abaaa909fb8185dfe05304b0
runtime: assist harder if GC exceeds the estimated marked heap

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/9070
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
src/runtime/mgc.go