diff options
| author | Michael Anthony Knyszek <mknyszek@google.com> | 2022-09-07 20:31:00 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-09-08 16:06:03 +0000 |
| commit | 2caaad942e15c148bfce33e06baa03d3a1557fcd (patch) | |
| tree | f0f8ab55d03077e628b44e307bc8d035f82fa004 /src/runtime | |
| parent | 5a379654952f8103d801cbccb5112c3e9976b104 (diff) | |
| download | go-2caaad942e15c148bfce33e06baa03d3a1557fcd.tar.xz | |
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>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/mgcscavenge.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/mgcscavenge.go b/src/runtime/mgcscavenge.go index bf38f87c77..c54ae34462 100644 --- a/src/runtime/mgcscavenge.go +++ b/src/runtime/mgcscavenge.go @@ -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 { |
