runtime: clear procid in unminit

Extra Ms can move between system threads. needm will reinitialize procid
(via minit) on the new thread, but leaving a stale procid behind after
dropm can be misleading if printing the M early in needm for debugging.

Change-Id: I668891971a0baeab31170d1e40a97126416e7379
Reviewed-on: https://go-review.googlesource.com/c/go/+/526118
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Michael Pratt 2023-09-06 10:31:32 -04:00 committed by Gopher Robot
parent f25ca8b33d
commit 4be921d888
9 changed files with 10 additions and 0 deletions

View File

@ -231,6 +231,7 @@ func minit() {
// Called from dropm to undo the effect of an minit.
func unminit() {
unminitSignals()
getg().m.procid = 0
}
// Called from exitm, but not from drop, to undo the effect of thread-owned

View File

@ -183,6 +183,7 @@ func minit() {
func unminit() {
unminitSignals()
getg().m.procid = 0
}
// Called from exitm, but not from drop, to undo the effect of thread-owned

View File

@ -344,6 +344,7 @@ func unminit() {
if !(GOOS == "ios" && GOARCH == "arm64") {
unminitSignals()
}
getg().m.procid = 0
}
// Called from exitm, but not from drop, to undo the effect of thread-owned

View File

@ -211,6 +211,7 @@ func minit() {
//go:nosplit
func unminit() {
unminitSignals()
getg().m.procid = 0
}
// Called from exitm, but not from drop, to undo the effect of thread-owned

View File

@ -328,6 +328,7 @@ func minit() {
//go:nosplit
func unminit() {
unminitSignals()
getg().m.procid = 0
}
// Called from exitm, but not from drop, to undo the effect of thread-owned

View File

@ -420,6 +420,7 @@ func minit() {
//go:nosplit
func unminit() {
unminitSignals()
getg().m.procid = 0
}
// Called from exitm, but not from drop, to undo the effect of thread-owned

View File

@ -316,6 +316,7 @@ func minit() {
//go:nosplit
func unminit() {
unminitSignals()
getg().m.procid = 0
}
// Called from exitm, but not from drop, to undo the effect of thread-owned

View File

@ -187,6 +187,7 @@ func minit() {
//go:nosplit
func unminit() {
unminitSignals()
getg().m.procid = 0
}
// Called from exitm, but not from drop, to undo the effect of thread-owned

View File

@ -1010,6 +1010,8 @@ func unminit() {
mp.thread = 0
}
unlock(&mp.threadLock)
mp.procid = 0
}
// Called from exitm, but not from drop, to undo the effect of thread-owned