]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: remove scavAddr in favor of address ranges
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 21 Nov 2019 17:05:14 +0000 (17:05 +0000)
committerMichael Knyszek <mknyszek@google.com>
Fri, 8 May 2020 16:24:40 +0000 (16:24 +0000)
commit55ec5182d7b84eb2461c495a55984162b23f3df8
tree87d24203820c776f090d73e93fd931cbfdcffdb4
parentb1a48af7e8ee87cc46e1bbb07f81ac4853e0f27b
runtime: remove scavAddr in favor of address ranges

This change removes the concept of s.scavAddr in favor of explicitly
reserving and unreserving address ranges. s.scavAddr has several
problems with raciness that can cause the scavenger to miss updates, or
move it back unnecessarily, forcing future scavenge calls to iterate
over searched address space unnecessarily.

This change achieves this by replacing scavAddr with a second addrRanges
which is cloned from s.inUse at the end of each sweep phase. Ranges from
this second addrRanges are then reserved by scavengers (with the
reservation size proportional to the heap size) who are then able to
safely iterate over those ranges without worry of another scavenger
coming in.

Fixes #35788.

Change-Id: Ief01ae170384174875118742f6c26b2a41cbb66d
Reviewed-on: https://go-review.googlesource.com/c/go/+/208378
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/export_test.go
src/runtime/extern.go
src/runtime/mgcscavenge.go
src/runtime/mgcscavenge_test.go
src/runtime/mgcsweep.go
src/runtime/mheap.go
src/runtime/mpagealloc.go
src/runtime/mranges.go