]> Cypherpunks repositories - gostls13.git/commit
runtime: bound sudog cache
authorDmitry Vyukov <dvyukov@google.com>
Mon, 2 Feb 2015 21:33:02 +0000 (00:33 +0300)
committerDmitry Vyukov <dvyukov@google.com>
Wed, 4 Mar 2015 14:14:29 +0000 (14:14 +0000)
commit5ef145c8099cc28ce4e41ecb7c6883041f68df04
treeb8409241efc9768cbd80969e7c388b6d66e4d873
parent60b8908588eb60b7e0d2053e52d191987a868c74
runtime: bound sudog cache

The unbounded list-based sudog cache can grow infinitely.
This can happen if a goroutine is routinely blocked on one P
and then unblocked and scheduled 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 sudog cache; local caches become fixed-size
with the only purpose of amortizing accesses to the
central cache.

The change required to move sudog cache from mcache to P,
because mcache is not scanned by GC.

Change-Id: I3bb7b14710354c026dcba28b3d3c8936a8db4e90
Reviewed-on: https://go-review.googlesource.com/3742
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
src/runtime/mcache.go
src/runtime/mgc.go
src/runtime/proc.go
src/runtime/proc1.go
src/runtime/runtime2.go