aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/proc.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2019-09-16 21:23:24 +0000
committerMichael Knyszek <mknyszek@google.com>2019-11-08 18:00:54 +0000
commita2cd2bd55d1e932b52f0b7dea45a85e058fc77d5 (patch)
tree1d58c63c070f9e46bc68dd8c33d11cac61035a86 /src/runtime/proc.go
parent81640ea38dc6577bdf1b206b778b968d341c27eb (diff)
downloadgo-a2cd2bd55d1e932b52f0b7dea45a85e058fc77d5.tar.xz
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>
Diffstat (limited to 'src/runtime/proc.go')
-rw-r--r--src/runtime/proc.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 3c3acf0dd7..67ff556ac4 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -4088,6 +4088,7 @@ func (pp *p) destroy() {
mheap_.spanalloc.free(unsafe.Pointer(pp.mspancache.buf[i]))
}
pp.mspancache.len = 0
+ pp.pcache.flush(&mheap_.pages)
})
freemcache(pp.mcache)
pp.mcache = nil