[go] runtime: fix nGsyscallNoP accounting

1 view
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Dec 23, 2025, 1:56:40 PM (2 days ago) Dec 23
to Michael Knyszek, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Cherry Mui, Go LUCI, Nicolas Hillegeer, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
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-by: Cherry Mui <cher...@google.com>
Auto-Submit: Michael Knyszek <mkny...@google.com>
Files:
  • M src/runtime/metrics_cgo_test.go
  • M src/runtime/proc.go
  • M src/runtime/testdata/testprogcgo/notingo.go
Change size: M
Delta: 3 files changed, 161 insertions(+), 12 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Cherry Mui
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I1ff1dfbf43bd4cf536b0965da370fee58e3f8753
Gerrit-Change-Number: 732320
Gerrit-PatchSet: 4
Gerrit-Owner: Michael Knyszek <mkny...@google.com>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
Gerrit-CC: Nicolas Hillegeer <ak...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages