]> Cypherpunks repositories - gostls13.git/commit
runtime: compute whether a span needs zeroing in the new page allocator
authorMichael Anthony Knyszek <mknyszek@google.com>
Mon, 28 Oct 2019 18:38:17 +0000 (18:38 +0000)
committerMichael Knyszek <mknyszek@google.com>
Thu, 7 Nov 2019 20:52:05 +0000 (20:52 +0000)
commita120cc8b365be33d3f82bbf8b79584e0e3439b9b
tree35bbea934a88a9ce0d95c4cb9705b1a2935834b6
parent933bf75edaf4e762f65e6738d5a9d71b6438b50f
runtime: compute whether a span needs zeroing in the new page allocator

This change adds the allocNeedZero method to mheap which uses the new
heapArena field zeroedBase to determine whether a new allocation needs
zeroing. The purpose of this work is to avoid zeroing memory that is
fresh from the OS in the context of the new allocator, where we no
longer have the concept of a free span to track this information.

The new field in heapArena, zeroedBase, is small, which runs counter to
the advice in the doc comment for heapArena. Since heapArenas are
already not a multiple of the system page size, this advice seems stale,
and we're OK with using an extra physical page for a heapArena. So, this
change also deletes the comment with that advice.

Updates #35112.

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