]> Cypherpunks repositories - gostls13.git/commit
runtime: ensure free and unscavenged spans may be backed by huge pages
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 18 Apr 2019 15:42:58 +0000 (15:42 +0000)
committerMichael Knyszek <mknyszek@google.com>
Mon, 6 May 2019 21:15:01 +0000 (21:15 +0000)
commit31c4e099158b0e4999c05ee4daf08531f6640ad4
tree1b7653c83e615dd9bfccd812e970a67bad7c2a5e
parent5c15ed64deaf71dd3b84470f3de8aae0b667d6ef
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>
src/runtime/mem_aix.go
src/runtime/mem_bsd.go
src/runtime/mem_darwin.go
src/runtime/mem_js.go
src/runtime/mem_linux.go
src/runtime/mem_plan9.go
src/runtime/mem_windows.go
src/runtime/mheap.go