aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/export_test.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2019-09-12 18:24:56 +0000
committerMichael Knyszek <mknyszek@google.com>2019-11-07 19:14:47 +0000
commite5ce13c178cc0be72ca220b4c3f0c95f570c19ab (patch)
treeb2c5f7c0307de829d86996d5c04b55cdea24e307 /src/runtime/export_test.go
parente1ddf0507c6d6dcbe1a2ebe54b8728498edf0995 (diff)
downloadgo-e5ce13c178cc0be72ca220b4c3f0c95f570c19ab.tar.gz
go-e5ce13c178cc0be72ca220b4c3f0c95f570c19ab.zip
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 <austin@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/export_test.go')
-rw-r--r--src/runtime/export_test.go4
1 files changed, 2 insertions, 2 deletions
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
}