]> Cypherpunks repositories - gostls13.git/commit
runtime: fix freed page accounting in mHeap_ReclaimList
authorAustin Clements <austin@google.com>
Tue, 14 Apr 2015 02:43:05 +0000 (22:43 -0400)
committerAustin Clements <austin@google.com>
Tue, 14 Apr 2015 20:55:14 +0000 (20:55 +0000)
commit69001e404ecd8a802c2c8bf87772e20f56ec78fd
treec1710c79bd088629ec6fdc9f1404f64e7c77e622
parentbedb6f8aef1f0374e3d4556b3b08dd9e52c16298
runtime: fix freed page accounting in mHeap_ReclaimList

mHeap_ReclaimList is asked to reclaim at least npages pages, but it
counts the number of spans reclaimed, not the number of pages
reclaimed. The number of spans reclaimed is strictly larger than the
number of pages, so this is not strictly wrong, but it is forcing more
reclamation than was intended by the caller, which delays large
allocations.

Fix this by increasing the count by the number of pages in the swept
span, rather than just increasing it by 1.

Fixes #9048.

Change-Id: I5ae364a9837a6012e68fcd431bba000340cfd50c
Reviewed-on: https://go-review.googlesource.com/8920
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/mheap.go