]> Cypherpunks repositories - gostls13.git/commit
runtime: change the span allocation policy to first-fit
authorMichael Anthony Knyszek <mknyszek@google.com>
Tue, 5 Feb 2019 00:06:55 +0000 (00:06 +0000)
committerMichael Knyszek <mknyszek@google.com>
Wed, 1 May 2019 14:50:40 +0000 (14:50 +0000)
commit40036a99a07ee89f59864c42af056bb5e33e696e
treefa98229e6095e5ea37556cc8125dd841de46bf5c
parente30aa166ea642876863107b90238abfc97932ba0
runtime: change the span allocation policy to first-fit

This change modifies the treap implementation to be address-ordered
instead of size-ordered, and further augments it so it may be used for
allocation. It then modifies the find method to implement a first-fit
allocation policy.

This change to the treap implementation consequently makes it so that
spans are scavenged in highest-address-first order without any
additional changes to the scavenging code. Because the treap itself is
now address ordered, and the scavenging code iterates over it in
reverse, the highest address is now chosen instead of the largest span.

This change also renames the now wrongly-named "scavengeLargest" method
on mheap to just "scavengeLocked" and also fixes up logic in that method
which made assumptions about size.

For #30333.

Change-Id: I94b6f3209211cc1bfdc8cdaea04152a232cfbbb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/164101
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/export_test.go
src/runtime/mgclarge.go
src/runtime/mheap.go
src/runtime/proc.go
src/runtime/treap_test.go