-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
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