From 1233de73884732f8be6dc26354848bd948848405 Mon Sep 17 00:00:00 2001 From: daan Date: Thu, 24 Sep 2020 16:29:41 -0700 Subject: [PATCH] use relaxed load for region count as that is monotonic --- src/region.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/region.c b/src/region.c index aa4f95b5..b6d0da31 100644 --- a/src/region.c +++ b/src/region.c @@ -240,7 +240,7 @@ static bool mi_region_is_suitable(const mem_region_t* region, int numa_node, boo static bool mi_region_try_claim(int numa_node, size_t blocks, bool allow_large, mem_region_t** region, mi_bitmap_index_t* bit_idx, mi_os_tld_t* tld) { // try all regions for a free slot - const size_t count = mi_atomic_load_acquire(®ions_count); + const size_t count = mi_atomic_load_relaxed(®ions_count); // monotonic, so ok to be relaxed size_t idx = tld->region_idx; // Or start at 0 to reuse low addresses? Starting at 0 seems to increase latency though for (size_t visited = 0; visited < count; visited++, idx++) { if (idx >= count) idx = 0; // wrap around