mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: add per-p page allocation cache
This change adds a per-p free page cache which the page allocator may allocate out of without a lock. The change also introduces a completely lockless page allocator fast path. Although the cache contains at most 64 pages (and usually less), the vast majority (85%+) of page allocations are exactly 1 page in size. Updates #35112. Change-Id: I170bf0a9375873e7e3230845eb1df7e5cf741b78 Reviewed-on: https://go-review.googlesource.com/c/go/+/195701 Run-TryBot: Michael Knyszek <mknyszek@google.com> Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
81640ea38d
commit
a2cd2bd55d
5 changed files with 86 additions and 20 deletions
|
|
@ -555,6 +555,7 @@ type p struct {
|
|||
sysmontick sysmontick // last tick observed by sysmon
|
||||
m muintptr // back-link to associated m (nil if idle)
|
||||
mcache *mcache
|
||||
pcache pageCache
|
||||
raceprocctx uintptr
|
||||
|
||||
deferpool [5][]*_defer // pool of available defer structs of different sizes (see panic.go)
|
||||
|
|
@ -611,7 +612,7 @@ type p struct {
|
|||
|
||||
palloc persistentAlloc // per-P to avoid mutex
|
||||
|
||||
// _ uint32 // Alignment for atomic fields below
|
||||
_ uint32 // Alignment for atomic fields below
|
||||
|
||||
// Per-P GC state
|
||||
gcAssistTime int64 // Nanoseconds in assistAlloc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue