]> Cypherpunks repositories - gostls13.git/commit
runtime: add scavenging code for new page allocator
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 21 Aug 2019 00:24:25 +0000 (00:24 +0000)
committerMichael Knyszek <mknyszek@google.com>
Thu, 7 Nov 2019 19:14:27 +0000 (19:14 +0000)
commit73317080e12234defb59f84e2b5b15f69650b5d5
tree299810e966e35857625c1323fe0da5d3c6cd4c88
parent39e8cb0faac7785f89b21246a45e8cf8d5bc7d95
runtime: add scavenging code for new page allocator

This change adds a scavenger for the new page allocator along with
tests. The scavenger walks over the heap backwards once per GC, looking
for memory to scavenge. It walks across the heap without any lock held,
searching optimistically. If it finds what appears to be a scavenging
candidate it acquires the heap lock and attempts to verify it. Upon
verification it then scavenges.

Notably, unlike the old scavenger, it doesn't show any preference for
huge pages and instead follows a more strict last-page-first policy.

Updates #35112.

Change-Id: I0621ef73c999a471843eab2d1307ae5679dd18d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/195697
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/export_test.go
src/runtime/malloc.go
src/runtime/mgcscavenge.go
src/runtime/mgcscavenge_test.go [new file with mode: 0644]
src/runtime/mpagealloc.go
src/runtime/mpagealloc_test.go
src/runtime/mpallocbits.go