diff options
author | Austin Clements <austin@google.com> | 2021-04-01 16:50:53 -0400 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2021-04-02 01:14:00 +0000 |
commit | 97b3ce430bb64fb6c8dfb244d400468932f2e984 (patch) | |
tree | 0ce6262c65078d3eef3636ea37642907ffc327dd /src/runtime/mgc.go | |
parent | 41e8a9f1cf78933ebdaf9fa29694df5129f1862c (diff) | |
download | go-97b3ce430bb64fb6c8dfb244d400468932f2e984.tar.gz go-97b3ce430bb64fb6c8dfb244d400468932f2e984.zip |
runtime: make gcTestMoveStackOnNextCall not double the stack
Currently, gcTestMoveStackOnNextCall doubles the stack allocation on
each call because stack movement always doubles the stack. That's
rather unfortunate if you're doing a bunch of stack movement tests in
a row that don't actually have to grow the stack because you'll
quickly hit the stack size limit even though you're hardly using any
of the stack.
Fix this by adding a special stack poison value for
gcTestMoveStackOnNextCall that newstack recognizes and inhibits the
allocation doubling.
Change-Id: Iace7055a0f33cb48dc97b8f4b46e45304bee832c
Reviewed-on: https://go-review.googlesource.com/c/go/+/306672
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/runtime/mgc.go')
-rw-r--r-- | src/runtime/mgc.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index f0c03b5102..4895fa5ef6 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -2352,7 +2352,7 @@ func fmtNSAsMS(buf []byte, ns uint64) []byte { // there's a preemption between this call and the next. func gcTestMoveStackOnNextCall() { gp := getg() - gp.stackguard0 = getcallersp() + gp.stackguard0 = stackForceMove } // gcTestIsReachable performs a GC and returns a bit set where bit i |