runtime: bound defer pools
The unbounded list-based defer pool can grow infinitely. This can happen if a goroutine routinely allocates a defer; then blocks on one P; and then unblocked, scheduled and frees the defer on another P. The scenario was reported on golang-nuts list. We've been here several times. Any unbounded local caches are bad and grow to infinite size. This change introduces central defer pool; local pools become fixed-size with the only purpose of amortizing accesses to the central pool. Change-Id: Iadcfb113ccecf912e1b64afc07926f0de9de2248 Reviewed-on: https://go-review.googlesource.com/3741Reviewed-by: Keith Randall <khr@golang.org>
Showing
Please register or sign in to comment