mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
60b8908588
commit
5ef145c809
5 changed files with 72 additions and 29 deletions
|
|
@ -24,8 +24,6 @@ type mcache struct {
|
|||
|
||||
stackcache [_NumStackOrders]stackfreelist
|
||||
|
||||
sudogcache *sudog
|
||||
|
||||
// Local allocator stats, flushed during GC.
|
||||
local_nlookup uintptr // number of pointer lookups
|
||||
local_largefree uintptr // bytes freed for large objects (>maxsmallsize)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue