mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
use relaxed load for last search position in an arena
This commit is contained in:
parent
2822e5c1f3
commit
b149099bf3
1 changed files with 2 additions and 2 deletions
|
@ -103,9 +103,9 @@ static size_t mi_block_count_of_size(size_t size) {
|
|||
----------------------------------------------------------- */
|
||||
static bool mi_arena_alloc(mi_arena_t* arena, size_t blocks, mi_bitmap_index_t* bitmap_idx)
|
||||
{
|
||||
size_t idx = mi_atomic_load_acquire(&arena->search_idx); // start from last search
|
||||
size_t idx = mi_atomic_load_relaxed(&arena->search_idx); // start from last search; ok to be relaxed as the exact start does not matter
|
||||
if (_mi_bitmap_try_find_from_claim_across(arena->blocks_inuse, arena->field_count, idx, blocks, bitmap_idx)) {
|
||||
mi_atomic_store_release(&arena->search_idx, idx); // start search from here next time
|
||||
mi_atomic_store_relaxed(&arena->search_idx, idx); // start search from here next time
|
||||
return true;
|
||||
};
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue