From e5ce13c178cc0be72ca220b4c3f0c95f570c19ab Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Thu, 12 Sep 2019 18:24:56 +0000 Subject: runtime: add option to scavenge with lock held throughout This change adds a "locked" parameter to scavenge() and scavengeone() which allows these methods to be run with the heap lock acquired, and synchronously with respect to others which acquire the heap lock. This mode is necessary for both heap-growth scavenging (multiple asynchronous scavengers here could be problematic) and debug.FreeOSMemory. Updates #35112. Change-Id: I24eea8e40f971760999c980981893676b4c9b666 Reviewed-on: https://go-review.googlesource.com/c/go/+/195699 Reviewed-by: Austin Clements Reviewed-by: Keith Randall --- src/runtime/export_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/runtime/export_test.go') diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index 435b330fe0..10066115b4 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -866,9 +866,9 @@ func (p *PageAlloc) Bounds() (ChunkIdx, ChunkIdx) { func (p *PageAlloc) PallocData(i ChunkIdx) *PallocData { return (*PallocData)(&((*pageAlloc)(p).chunks[i])) } -func (p *PageAlloc) Scavenge(nbytes uintptr) (r uintptr) { +func (p *PageAlloc) Scavenge(nbytes uintptr, locked bool) (r uintptr) { systemstack(func() { - r = (*pageAlloc)(p).scavenge(nbytes) + r = (*pageAlloc)(p).scavenge(nbytes, locked) }) return } -- cgit v1.3