]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: initialize scavengeIndex fields properly
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 19 Apr 2023 22:00:23 +0000 (22:00 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 20 Apr 2023 15:25:16 +0000 (15:25 +0000)
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 <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>

src/runtime/mgcscavenge.go
src/runtime/mpagealloc.go

index 5976ab49ccea3dad8040fbb2b1b6c37c81a510d9..664c93373388da3415e172f8471a1b108f8c3f59 100644 (file)
@@ -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) {
index da1b14e5a4f5e01b772b8a10bad80f5a1c979935..7c4d8ba2c981f160637dcc061861939098c00872 100644 (file)
@@ -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