From: Michael Anthony Knyszek Date: Wed, 19 Apr 2023 22:00:23 +0000 (+0000) Subject: runtime: initialize scavengeIndex fields properly X-Git-Tag: go1.21rc1~836 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8588a3fa08c1eb320869781926f83d3928a7de4e;p=gostls13.git runtime: initialize scavengeIndex fields properly Currently these fields are uninitialized causing failures on aix-ppc64, which has a slightly oddly-defined address space compared to the rest. Change-Id: I2aa46731174154dce86c2074bd0b00eef955d86d Reviewed-on: https://go-review.googlesource.com/c/go/+/486655 Auto-Submit: Michael Knyszek Reviewed-by: Michael Pratt Run-TryBot: Michael Knyszek TryBot-Bypass: Michael Knyszek --- diff --git a/src/runtime/mgcscavenge.go b/src/runtime/mgcscavenge.go index 5976ab49cc..664c933733 100644 --- a/src/runtime/mgcscavenge.go +++ b/src/runtime/mgcscavenge.go @@ -1055,6 +1055,13 @@ type scavengeIndex struct { test bool } +// init initializes the scavengeIndex. +func (s *scavengeIndex) init() { + s.searchAddrBg.Clear() + s.searchAddrForce.Clear() + s.freeHWM = minOffAddr +} + // find returns the highest chunk index that may contain pages available to scavenge. // It also returns an offset to start searching in the highest chunk. func (s *scavengeIndex) find(force bool) (chunkIdx, uint) { diff --git a/src/runtime/mpagealloc.go b/src/runtime/mpagealloc.go index da1b14e5a4..7c4d8ba2c9 100644 --- a/src/runtime/mpagealloc.go +++ b/src/runtime/mpagealloc.go @@ -321,6 +321,9 @@ func (p *pageAlloc) init(mheapLock *mutex, sysStat *sysMemStat, test bool) { // Set the mheapLock. p.mheapLock = mheapLock + // Initialize the scavenge index. + p.scav.index.init() + // Set if we're in a test. p.test = test p.scav.index.test = test