aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/mem_linux.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/mem_linux.go b/src/runtime/mem_linux.go
index 31815fb421..b456f7f2ff 100644
--- a/src/runtime/mem_linux.go
+++ b/src/runtime/mem_linux.go
@@ -92,6 +92,11 @@ func sysHugePageOS(v unsafe.Pointer, n uintptr) {
}
func sysNoHugePageOS(v unsafe.Pointer, n uintptr) {
+ if uintptr(v)&(physPageSize-1) != 0 {
+ // The Linux implementation requires that the address
+ // addr be page-aligned, and allows length to be zero.
+ throw("unaligned sysNoHugePageOS")
+ }
madvise(v, n, _MADV_NOHUGEPAGE)
}