aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime1.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2021-10-18 19:01:33 +0000
committerMichael Knyszek <mknyszek@google.com>2021-11-05 17:46:41 +0000
commitf063e0da28d441065d36f7d676f86d478f67db1f (patch)
treefe9b9eb65be12c6d21f37058edcd12050968782b /src/runtime/runtime1.go
parent4f543b59c5618abccf0e78a17a2aeb173c085a91 (diff)
downloadgo-f063e0da28d441065d36f7d676f86d478f67db1f.tar.xz
runtime: add harddecommit GODEBUG flag
This change adds a new debug flag that makes the runtime map pages PROT_NONE in sysUnused on Linux, in addition to the usual madvise calls. This behavior mimics the behavior of decommit on Windows, and is helpful in debugging the scavenger. sysUsed is also updated to re-map the pages as PROT_READ|PROT_WRITE, mimicing Windows' explicit commit behavior. Change-Id: Iaac5fcd0e6920bd1d0e753dd4e7f0c0b128fe842 Reviewed-on: https://go-review.googlesource.com/c/go/+/356612 Trust: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/runtime1.go')
-rw-r--r--src/runtime/runtime1.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go
index b6c3cbfff4..65e1e0eebc 100644
--- a/src/runtime/runtime1.go
+++ b/src/runtime/runtime1.go
@@ -315,6 +315,7 @@ var debug struct {
schedtrace int32
tracebackancestors int32
asyncpreemptoff int32
+ harddecommit int32
// debug.malloc is used as a combined debug check
// in the malloc function and should be set
@@ -344,6 +345,7 @@ var dbgvars = []dbgVar{
{"tracebackancestors", &debug.tracebackancestors},
{"asyncpreemptoff", &debug.asyncpreemptoff},
{"inittrace", &debug.inittrace},
+ {"harddecommit", &debug.harddecommit},
}
func parsedebugvars() {