Skip to content

Commit

Permalink
runtime: initialize scavengeIndex fields properly
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Michael Pratt <[email protected]>
Run-TryBot: Michael Knyszek <[email protected]>
TryBot-Bypass: Michael Knyszek <[email protected]>
  • Loading branch information
mknyszek authored and gopherbot committed Apr 20, 2023
1 parent 4f9a966 commit 8588a3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/runtime/mgcscavenge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions src/runtime/mpagealloc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8588a3f

Please sign in to comment.