[UNTESTED] optimized atomics for fan-out
This commit is contained in:
@@ -484,8 +484,8 @@ class FanOutFabric {
|
|||||||
|
|
||||||
for (std::size_t i = head; i != tail;
|
for (std::size_t i = head; i != tail;
|
||||||
i = ((i + 1) & CONSUMER_QSIZE_MASK)) {
|
i = ((i + 1) & CONSUMER_QSIZE_MASK)) {
|
||||||
RefCountType cnt =
|
RefCountType cnt = buffer[qbuffer[i]].count.fetch_sub(
|
||||||
buffer[qbuffer[i]].count.fetch_sub(1);
|
1, std::memory_order_relaxed);
|
||||||
|
|
||||||
if (cnt == 1 && dealloc_try<thread_id>(qbuffer[i]) !=
|
if (cnt == 1 && dealloc_try<thread_id>(qbuffer[i]) !=
|
||||||
FanOutFabricDeallocResult::Ok)
|
FanOutFabricDeallocResult::Ok)
|
||||||
@@ -547,7 +547,8 @@ class FanOutFabric {
|
|||||||
THREAD_BITMAP_MASK;
|
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) {
|
if (try_cnt == failed_cnt) {
|
||||||
fs.push(slot);
|
fs.push(slot);
|
||||||
@@ -609,7 +610,7 @@ class FanOutFabric {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reclaim_cnt >= budget &&
|
if (reclaim_cnt >= budget &&
|
||||||
!reclaim_queues[idx].is_empty())
|
head != reclaim_queues[idx].get_tail())
|
||||||
reclaim_hint.fetch_or(
|
reclaim_hint.fetch_or(
|
||||||
BitmapType(1) << idx,
|
BitmapType(1) << idx,
|
||||||
std::memory_order_relaxed);
|
std::memory_order_relaxed);
|
||||||
@@ -639,7 +640,7 @@ class FanOutFabric {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reclaim_cnt >= budget &&
|
if (reclaim_cnt >= budget &&
|
||||||
!reclaim_queues[idx].is_empty())
|
head != reclaim_queues[idx].get_tail())
|
||||||
reclaim_hint.fetch_or(
|
reclaim_hint.fetch_or(
|
||||||
BitmapType(1) << idx,
|
BitmapType(1) << idx,
|
||||||
std::memory_order_relaxed);
|
std::memory_order_relaxed);
|
||||||
|
|||||||
Reference in New Issue
Block a user