]> Cypherpunks repositories - gostls13.git/commit
runtime: bound defer pools
authorDmitry Vyukov <dvyukov@google.com>
Tue, 3 Feb 2015 05:58:04 +0000 (08:58 +0300)
committerDmitry Vyukov <dvyukov@google.com>
Wed, 4 Feb 2015 04:38:11 +0000 (04:38 +0000)
commit805907115352801a54f987fc9079251b478cce3f
treedad8856b1e25252f401bd5759d5ca5ff8876ac30
parent71be0138421012d04e06991d37d19c9f5b1fa02b
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/3741
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/mgc0.go
src/runtime/panic.go
src/runtime/proc1.go
src/runtime/runtime2.go