runtime: add physHugePageSize

This change adds the global physHugePageSize which is initialized in
osinit(). physHugePageSize contains the system's transparent huge page
(or superpage) size in bytes.

For #30333.

Change-Id: I2f0198c40729dbbe6e6f2676cef1d57dd107562c
Reviewed-on: https://go-review.googlesource.com/c/go/+/170858
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Michael Anthony Knyszek 2019-03-29 20:03:29 +00:00 committed by Michael Knyszek
parent 8b2bd6f5ff
commit 1033065ee3
2 changed files with 31 additions and 0 deletions

View file

@ -324,6 +324,14 @@ const (
// mallocinit.
var physPageSize uintptr
// physHugePageSize is the size in bytes of the OS's default physical huge
// page size whose allocation is opaque to the application.
//
// If set, this must be set by the OS init code (typically in osinit) before
// mallocinit. However, setting it at all is optional, and leaving the default
// value is always safe (though potentially less efficient).
var physHugePageSize uintptr
// OS-defined helpers:
//
// sysAlloc obtains a large chunk of zeroed memory from the