]> Cypherpunks repositories - gostls13.git/commit
runtime: remove in-use page count loop from STW
authorAustin Clements <austin@google.com>
Sat, 26 Sep 2015 16:31:59 +0000 (12:31 -0400)
committerAustin Clements <austin@google.com>
Fri, 2 Oct 2015 19:55:55 +0000 (19:55 +0000)
commitdac220b0a9d561744b01196c53dd1775cfb5492c
treebfda0bc0ff5d856a748aa14cefb31329a0d1969c
parent608c1b0d56200a66e4e0a0f9902f0b5103683e60
runtime: remove in-use page count loop from STW

In order to compute the sweep ratio, the runtime needs to know how
many pages belong to spans in state _MSpanInUse. Currently it finds
this out by looping over all spans during mark termination. However,
this takes ~1ms/heap GB, so multi-gigabyte heaps can quickly push our
STW time past 10ms.

Replace the loop with an actively maintained count of in-use pages.

For multi-gigabyte heaps, this reduces max mark termination pause time
by 75%–90% relative to tip and by 85%–95% relative to Go 1.5.1. This
shifts the longest pause time for large heaps to the sweep termination
phase, so it only slightly decreases max pause time, though it roughly
halves mean pause time. Here are the results for the garbage
benchmark:

               ---- max mark termination pause ----
Heap   Procs   after change   before change   1.5.1
24GB     12        1.9ms          18ms         37ms
24GB      4        3.7ms          18ms         37ms
 4GB      4        920µs         3.8ms        6.9ms

Fixes #11484.

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