]> Cypherpunks repositories - gostls13.git/commit
runtime: add per-p mspan cache
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 18 Sep 2019 15:57:36 +0000 (15:57 +0000)
committerMichael Knyszek <mknyszek@google.com>
Fri, 8 Nov 2019 17:01:32 +0000 (17:01 +0000)
commit4517c02f284cc19262304ba22c1c98b2bbdb0208
treeafd70218f58aa49b881c2d5335ccb1a6ffe92e04
parenta762221bea7c02a17cffc6937d8af33a027a32e5
runtime: add per-p mspan cache

This change adds a per-p mspan object cache similar to the sudog cache.
Unfortunately this cache can't quite operate like the sudog cache, since
it is used in contexts where write barriers are disallowed (i.e.
allocation codepaths), so rather than managing an array and a slice,
it's just an array and a length. A little bit more unsafe, but avoids
any write barriers.

The purpose of this change is to reduce the number of operations which
require the heap lock in allocation, paving the way for a lockless fast
path.

Updates #35112.

Change-Id: I32cfdcd8528fb7be985640e4f3a13cb98ffb7865
Reviewed-on: https://go-review.googlesource.com/c/go/+/196642
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/mheap.go
src/runtime/proc.go
src/runtime/runtime2.go