From e6135c27682988a490166629f6a52f5102791bcb Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Mon, 28 Oct 2019 20:38:59 +0000 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Austin Clements --- src/runtime/malloc.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index 2fd71fab2d7..ef1c975cea3 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -19,7 +19,7 @@ // fixalloc: a free-list allocator for fixed-size off-heap objects, // used to manage storage used by the allocator. // 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. // mcache: a per-P cache of mspans with free space. // mstats: allocation statistics. @@ -56,13 +56,8 @@ // it is placed on the mcentral free list for the mspan's size // class. // -// 3. Otherwise, if all objects in the mspan are free, the mspan -// is now "idle", so it is returned to the mheap and no longer -// 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. +// 3. Otherwise, if all objects in the mspan are free, the mspan's +// pages are returned to the mheap and the mspan is now dead. // // Allocating and freeing a large object uses the mheap // directly, bypassing the mcache and mcentral. @@ -324,7 +319,7 @@ const ( minLegalPointer uintptr = 4096 // 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.