[UNTESTED] optimized atomics for fan-out

This commit is contained in:
2026-01-04 12:00:43 -05:00
parent c1745b7bfc
commit 103903be8e

View File

@@ -484,8 +484,8 @@ class FanOutFabric {
for (std::size_t i = head; i != tail;
i = ((i + 1) & CONSUMER_QSIZE_MASK)) {
RefCountType cnt =
buffer[qbuffer[i]].count.fetch_sub(1);
RefCountType cnt = buffer[qbuffer[i]].count.fetch_sub(
1, std::memory_order_relaxed);
if (cnt == 1 && dealloc_try<thread_id>(qbuffer[i]) !=
FanOutFabricDeallocResult::Ok)
@@ -547,7 +547,8 @@ class FanOutFabric {
THREAD_BITMAP_MASK;
}
buffer[slot].count.fetch_sub(failed_cnt);
buffer[slot].count.fetch_sub(failed_cnt,
std::memory_order_relaxed);
if (try_cnt == failed_cnt) {
fs.push(slot);
@@ -609,7 +610,7 @@ class FanOutFabric {
}
if (reclaim_cnt >= budget &&
!reclaim_queues[idx].is_empty())
head != reclaim_queues[idx].get_tail())
reclaim_hint.fetch_or(
BitmapType(1) << idx,
std::memory_order_relaxed);
@@ -639,7 +640,7 @@ class FanOutFabric {
}
if (reclaim_cnt >= budget &&
!reclaim_queues[idx].is_empty())
head != reclaim_queues[idx].get_tail())
reclaim_hint.fetch_or(
BitmapType(1) << idx,
std::memory_order_relaxed);