aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime2.go
diff options
context:
space:
mode:
authorDaniel Morsing <daniel.morsing@gmail.com>2025-11-27 14:49:09 +0000
committerGopher Robot <gobot@golang.org>2026-02-27 12:41:12 -0800
commit62a1da372a2bfeb29644246ff0f61dc048bb912c (patch)
tree8aa901636e926591fbac77afd575e61b9c1d6dba /src/runtime/runtime2.go
parent6a712954669bc9cdbf748be5b2b6613af41a2675 (diff)
downloadgo-62a1da372a2bfeb29644246ff0f61dc048bb912c.tar.xz
runtime: do signal stack clearing when parking Ms
Clearing signal stacks during STW meant an added latency that was linear with respect to the number of Ms, parked or running. Since that number be quite high, we need an alternate scheme. Instead of clearing in the GC cycle, clear the signal stack whenever an M is parked and has the potential to stay parked until the end of the next GC cycle. This implements the wanted behavior for runtime/secret at the cost of a little bit of extra latency that will be dwarfed by the time it takes to perform a syscall. Change-Id: Ieb9618f46736c34486e17a3d6185661a98756d0d Reviewed-on: https://go-review.googlesource.com/c/go/+/724282 Auto-Submit: Daniel Morsing <daniel.morsing@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/runtime2.go')
-rw-r--r--src/runtime/runtime2.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 578458afa0..95dc834717 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -620,15 +620,18 @@ type m struct {
// Fields whose offsets are not known to debuggers.
- procid uint64 // for debuggers, but offset not hard-coded
- gsignal *g // signal-handling g
- goSigStack gsignalStack // Go-allocated signal handling stack
- sigmask sigset // storage for saved signal mask
- tls [tlsSlots]uintptr // thread-local storage (for x86 extern register)
- mstartfn func()
- curg *g // current running goroutine
- caughtsig guintptr // goroutine running during fatal signal
- signalSecret uint32 // whether we have secret information in our signal stack
+ procid uint64 // for debuggers, but offset not hard-coded
+ gsignal *g // signal-handling g
+ goSigStack gsignalStack // Go-allocated signal handling stack
+ sigmask sigset // storage for saved signal mask
+ tls [tlsSlots]uintptr // thread-local storage (for x86 extern register)
+ mstartfn func()
+ curg *g // current running goroutine
+ caughtsig guintptr // goroutine running during fatal signal
+
+ // Indicates whether we've received a signal while
+ // running in secret mode.
+ signalSecret bool
// p is the currently attached P for executing Go code, nil if not executing user Go code.
//