]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: don't rescan finalizers queue during mark termination
authorAustin Clements <austin@google.com>
Tue, 31 Jan 2017 16:46:36 +0000 (11:46 -0500)
committerAustin Clements <austin@google.com>
Fri, 3 Mar 2017 17:02:14 +0000 (17:02 +0000)
commitf1ba75f8c577e1471f646ef3715fc2f41dd423ef
treef92e128a4737bbd93635e33325d4dd9045df1da5
parent98da2d1f91a8f4e6bdaecd8a98fc77cbac211c80
runtime: don't rescan finalizers queue during mark termination

Currently we scan the finalizers queue both during concurrent mark and
during mark termination. This costs roughly 20ns per queued finalizer
and about 1ns per unused finalizer queue slot (allocated queue length
never decreases), which can drive up STW time if there are many
finalizers.

However, we only add finalizers to this queue during sweeping, which
means that the second scan will never find anything new. Hence, we can
fix this by simply not scanning the finalizers queue during mark
termination. This brings the STW time under the 100µs goal even with
1,000,000 queued finalizers.

Fixes #18869.

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