Skip to content

Commit 2caaad9

Browse files
mknyszekgopherbot
authored andcommitted
runtime: use searchIdx in scavengeOne
This is an optimization that prevents N^2 behavior within a chunk, but was accidentally skipped. There should be no functional change as a result of this CL. Fixes #54892. Change-Id: I861967a2268699fdc3464bd41bc56618b5628e6b Reviewed-on: https://go-review.googlesource.com/c/go/+/429255 Auto-Submit: Michael Knyszek <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Michael Knyszek <[email protected]>
1 parent 5a37965 commit 2caaad9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/mgcscavenge.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ func (p *pageAlloc) scavengeOne(ci chunkIdx, searchIdx uint, max uintptr) uintpt
718718
if p.summary[len(p.summary)-1][ci].max() >= uint(minPages) {
719719
// We only bother looking for a candidate if there at least
720720
// minPages free pages at all.
721-
base, npages := p.chunkOf(ci).findScavengeCandidate(pallocChunkPages-1, minPages, maxPages)
721+
base, npages := p.chunkOf(ci).findScavengeCandidate(searchIdx, minPages, maxPages)
722722

723723
// If we found something, scavenge it and return!
724724
if npages != 0 {

0 commit comments

Comments
 (0)