]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: add sysNoHugePage
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 2 Nov 2022 16:47:09 +0000 (16:47 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 5 Apr 2023 21:43:42 +0000 (21:43 +0000)
Change-Id: Icccafb896de838256a2ec7c3f385e6cbb2b415fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/447360
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/runtime/mem.go
src/runtime/mem_aix.go
src/runtime/mem_bsd.go
src/runtime/mem_darwin.go
src/runtime/mem_linux.go
src/runtime/mem_sbrk.go
src/runtime/mem_windows.go

index 0ca933b25b61742b4c49400b0acdb3bfb7a2aba5..7b019052247d942e70405fd6085ab21368744582 100644 (file)
@@ -84,6 +84,13 @@ func sysHugePage(v unsafe.Pointer, n uintptr) {
        sysHugePageOS(v, n)
 }
 
+// sysNoHugePage does not transition memory regions, but instead provides a
+// hint to the OS that it would be less efficient to back this memory region
+// with pages of a larger size transparently.
+func sysNoHugePage(v unsafe.Pointer, n uintptr) {
+       sysNoHugePageOS(v, n)
+}
+
 // sysFree transitions a memory region from any state to None. Therefore, it
 // returns memory unconditionally. It is used if an out-of-memory error has been
 // detected midway through an allocation or to carve out an aligned section of
index 21726b56aec91082e7b70b21527755859b0360c1..deae61635cddd42f0fb85c99be1840b58d46609e 100644 (file)
@@ -38,6 +38,9 @@ func sysUsedOS(v unsafe.Pointer, n uintptr) {
 func sysHugePageOS(v unsafe.Pointer, n uintptr) {
 }
 
+func sysNoHugePageOS(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.
 //
index 6c5edb17c232ee4014948f8cb16d256ae904af76..a9025ad015338098f09f4b6cd19e4d85ee076276 100644 (file)
@@ -36,6 +36,9 @@ func sysUsedOS(v unsafe.Pointer, n uintptr) {
 func sysHugePageOS(v unsafe.Pointer, n uintptr) {
 }
 
+func sysNoHugePageOS(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.
 //
index 25862cf16176e1129f7c76f44d19335bb2a08ca7..1e3e53d45b94a42fd0788a2b46ca957ea3676d95 100644 (file)
@@ -36,6 +36,9 @@ func sysUsedOS(v unsafe.Pointer, n uintptr) {
 func sysHugePageOS(v unsafe.Pointer, n uintptr) {
 }
 
+func sysNoHugePageOS(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.
 //
index 1630664cff8a96833b25963ab445067699e959d7..96e890eedbf14fa311ea023697482b69935414b4 100644 (file)
@@ -161,6 +161,10 @@ func sysHugePageOS(v unsafe.Pointer, n uintptr) {
        }
 }
 
+func sysNoHugePageOS(v unsafe.Pointer, n uintptr) {
+       madvise(v, n, _MADV_NOHUGEPAGE)
+}
+
 // Don't split the stack as this function may be invoked without a valid G,
 // which prevents us from allocating more stack.
 //
index 4d5d3d7ce314367f8333fbdcdd1f693b66133a97..c8f50e7bd57e6b392c8e5168d52d66d0789c11f0 100644 (file)
@@ -160,6 +160,9 @@ func sysUsedOS(v unsafe.Pointer, n uintptr) {
 func sysHugePageOS(v unsafe.Pointer, n uintptr) {
 }
 
+func sysNoHugePageOS(v unsafe.Pointer, n uintptr) {
+}
+
 func sysMapOS(v unsafe.Pointer, n uintptr) {
 }
 
index b1292fc72526c1bcbc3137677eef610c98a0a8f5..c11abc17addd092f9894bf7408b9842d5fa63836 100644 (file)
@@ -94,6 +94,9 @@ func sysUsedOS(v unsafe.Pointer, n uintptr) {
 func sysHugePageOS(v unsafe.Pointer, n uintptr) {
 }
 
+func sysNoHugePageOS(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.
 //