[go] runtime: free spanQueue on P destroy

0 views
Skip to first unread message

Michael Pratt (Gerrit)

unread,
Oct 7, 2025, 3:16:57 PM (17 hours ago) Oct 7
to Michael Pratt, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Michael Knyszek, Go LUCI, golang-co...@googlegroups.com

Michael Pratt submitted the change

Change information

Commit message:
runtime: free spanQueue on P destroy

Span queues must be empty when destroying a P since we are outside of
the mark phase. But we don't actually free them, so they simply sit
around using memory. More importantly, they are still in
work.spanSPMCs.all, so freeDeadSpanSPMCs must continue traversing past
them until the end of time.

Prior to CL 709575, keeping them in work.spanSPMCs.all allowed programs
with low GOMAXPROCS to continue triggering the bug if they ever had high
GOMAXPROCS in the past.

The spanSPMCs list is singly-linked, so it is not efficient to remove a
random element from the middle. Instead, we simply mark it as dead to
all freeDeadSpanSPMCs to free it when it scans the full list.

For #75771.
Change-Id: I6a6a636cfa22a4bdef0c273d083c91553e923fe5
Reviewed-by: Michael Knyszek <mkny...@google.com>
Files:
  • M src/runtime/mgcmark_greenteagc.go
  • M src/runtime/mgcmark_nogreenteagc.go
  • M src/runtime/proc.go
Change size: S
Delta: 3 files changed, 39 insertions(+), 0 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Michael Knyszek
  • 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: I6a6a636cfa22a4bdef0c273d083c91553e923fe5
Gerrit-Change-Number: 709656
Gerrit-PatchSet: 2
Gerrit-Owner: Michael Pratt <mpr...@google.com>
Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages