]> git.feebdaed.xyz Git - 0xmirror/go.git/commit
runtime: fix nGsyscallNoP accounting
authorMichael Anthony Knyszek <mknyszek@google.com>
Tue, 23 Dec 2025 17:16:17 +0000 (17:16 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 23 Dec 2025 18:56:35 +0000 (10:56 -0800)
commit81283ad33985958c63e43ada6c168da49e62de0f
treee93f968dfd6af44296ce7e727a005b5cc3dd473a
parent3e0e1667f694e989371e021dd8f269dae5a78e9f
runtime: fix nGsyscallNoP accounting

CL 726964 has two bugs.

One is fairly obvious. Where there was previous a decrement of
nGsyscallNoP in exitsyscallTryGetP, it added a call to addGSyscallNoP.
Oops.

The other is more subtle. In needm we set isExtraInC to false very
early. This will cause exitsyscall (via cgocallbackg) to decrement
nGsyscallNoP when the thread never had a corresponding increment. (It
could not have, otherwise it would not have called needm, on Linux
anyway.) The fix is simple: increment nGsyscallNoP. CL 726964 actually
removed this increment erroneously. I'm pretty sure I removed it because
the first bug was the real issue, and removing this increment "fixed it"
in the context of the test. I was right that this case was subtle, but
wrong about how.

Fixes #76435.

Change-Id: I1ff1dfbf43bd4cf536b0965da370fee58e3f8753
Reviewed-on: https://go-review.googlesource.com/c/go/+/732320
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/runtime/metrics_cgo_test.go
src/runtime/proc.go
src/runtime/testdata/testprogcgo/notingo.go