1
0
mirror of https://github.com/golang/go synced 2024-11-07 01:46:15 -07:00

runtime: switch to new page allocator

This change flips the oldPageAllocator constant enabling the new page
allocator in the Go runtime.

Updates #35112.

Change-Id: I7fc8332af9fd0e43ce28dd5ebc1c1ce519ce6d0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/201765
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Michael Anthony Knyszek 2019-10-28 20:38:59 +00:00 committed by Michael Knyszek
parent 52d5e76b39
commit e6135c2768

View File

@ -19,7 +19,7 @@
// fixalloc: a free-list allocator for fixed-size off-heap objects, // fixalloc: a free-list allocator for fixed-size off-heap objects,
// used to manage storage used by the allocator. // used to manage storage used by the allocator.
// mheap: the malloc heap, managed at page (8192-byte) granularity. // mheap: the malloc heap, managed at page (8192-byte) granularity.
// mspan: a run of pages managed by the mheap. // mspan: a run of in-use pages managed by the mheap.
// mcentral: collects all spans of a given size class. // mcentral: collects all spans of a given size class.
// mcache: a per-P cache of mspans with free space. // mcache: a per-P cache of mspans with free space.
// mstats: allocation statistics. // mstats: allocation statistics.
@ -56,13 +56,8 @@
// it is placed on the mcentral free list for the mspan's size // it is placed on the mcentral free list for the mspan's size
// class. // class.
// //
// 3. Otherwise, if all objects in the mspan are free, the mspan // 3. Otherwise, if all objects in the mspan are free, the mspan's
// is now "idle", so it is returned to the mheap and no longer // pages are returned to the mheap and the mspan is now dead.
// has a size class.
// This may coalesce it with adjacent idle mspans.
//
// 4. If an mspan remains idle for long enough, return its pages
// to the operating system.
// //
// Allocating and freeing a large object uses the mheap // Allocating and freeing a large object uses the mheap
// directly, bypassing the mcache and mcentral. // directly, bypassing the mcache and mcentral.
@ -324,7 +319,7 @@ const (
minLegalPointer uintptr = 4096 minLegalPointer uintptr = 4096
// Whether to use the old page allocator or not. // Whether to use the old page allocator or not.
oldPageAllocator = true oldPageAllocator = false
) )
// physPageSize is the size in bytes of the OS's physical pages. // physPageSize is the size in bytes of the OS's physical pages.