aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mem_bsd.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2019-04-18 15:42:58 +0000
committerMichael Knyszek <mknyszek@google.com>2019-05-06 21:15:01 +0000
commit31c4e099158b0e4999c05ee4daf08531f6640ad4 (patch)
tree1b7653c83e615dd9bfccd812e970a67bad7c2a5e /src/runtime/mem_bsd.go
parent5c15ed64deaf71dd3b84470f3de8aae0b667d6ef (diff)
downloadgo-31c4e099158b0e4999c05ee4daf08531f6640ad4.tar.gz
go-31c4e099158b0e4999c05ee4daf08531f6640ad4.zip
runtime: ensure free and unscavenged spans may be backed by huge pages
This change adds a new sysHugePage function to provide the equivalent of Linux's madvise(MADV_HUGEPAGE) support to the runtime. It then uses sysHugePage to mark a newly-coalesced free span as backable by huge pages to make the freeHugePages approximation a bit more accurate. The problem being solved here is that if a large free span is composed of many small spans which were coalesced together, then there's a chance that they have had madvise(MADV_NOHUGEPAGE) called on them at some point, which makes freeHugePages less accurate. For #30333. Change-Id: Idd4b02567619fc8d45647d9abd18da42f96f0522 Reviewed-on: https://go-review.googlesource.com/c/go/+/173338 Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/mem_bsd.go')
-rw-r--r--src/runtime/mem_bsd.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/runtime/mem_bsd.go b/src/runtime/mem_bsd.go
index 3977e4ae9e..08a2391610 100644
--- a/src/runtime/mem_bsd.go
+++ b/src/runtime/mem_bsd.go
@@ -29,6 +29,9 @@ func sysUnused(v unsafe.Pointer, n uintptr) {
func sysUsed(v unsafe.Pointer, n uintptr) {
}
+func sysHugePage(v unsafe.Pointer, n uintptr) {
+}
+
// Don't split the stack as this function may be invoked without a valid G,
// which prevents us from allocating more stack.
//go:nosplit