Skip to content

runtime: excessive spinning in freeSomeSpanSPMCs #75771

@prattmic

Description

@prattmic

Added in https://go.dev/cl/700496, freeSomeSpanSPMCs frees dead queues from work.spanSPMCs.

It inherits a similar batching mechanism as freeSomeWbufs to stop early if preempted or after processing 64 entries, to allow preemption if the list is long.

But the big difference between freeSomeWbufs and freeSomeSpanSPMCs is that the former unconditionally frees each workbuf. That is, it always makes progress.

On the other hand, freeSomeSpanSPMCs only frees dead entries. If there are >64 live entries, each call to freeSomeSpanSPMCs may make no progress. bgsweep will then call freeSomeSpanSPMCs in an infinite loop until the GC cycle ends, at which point freeSomeSpanSPMCs returns success early.

It should be difficult (impossible?) to get >64 permanently live entries unless GOMAXPROCS > 64.

The quick fix is to make this processing non-preemptible. If there are programs that can easily make this list very long then we may want a more clever scheme that can work in batches.

cc @mknyszek @golang/runtime

Metadata

Metadata

Assignees

Labels

SoonThis needs action soon. (recent regressions, service outages, unusual time-sensitive situations)compiler/runtimeIssues related to the Go compiler and/or runtime.release-blocker

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions