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
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:
Code-Review: +2 by Cherry Mui
TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI