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 <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Michael Anthony Knyszek 2022-09-07 20:31:00 +00:00 committed by Gopher Robot
parent 5a37965495
commit 2caaad942e
1 changed files with 1 additions and 1 deletions

View File

@ -718,7 +718,7 @@ func (p *pageAlloc) scavengeOne(ci chunkIdx, searchIdx uint, max uintptr) uintpt
if p.summary[len(p.summary)-1][ci].max() >= uint(minPages) {
// We only bother looking for a candidate if there at least
// minPages free pages at all.
base, npages := p.chunkOf(ci).findScavengeCandidate(pallocChunkPages-1, minPages, maxPages)
base, npages := p.chunkOf(ci).findScavengeCandidate(searchIdx, minPages, maxPages)
// If we found something, scavenge it and return!
if npages != 0 {