MINOR: pools: use EBO to wait for unlock during pool_flush()

pool_flush() could become a source of contention on the pool's free list
if there are many competing thread using that pool. Let's make sure we
use EBO and not just a simple CPU relaxation there, to avoid disturbing
them.
This commit is contained in:
Willy Tarreau 2023-08-17 09:04:35 +02:00
parent 78fa54863d
commit 544c2f2d9e
1 changed files with 3 additions and 4 deletions

View File

@ -749,10 +749,9 @@ void pool_flush(struct pool_head *pool)
for (bucket = 0; bucket < CONFIG_HAP_POOL_BUCKETS; bucket++) { for (bucket = 0; bucket < CONFIG_HAP_POOL_BUCKETS; bucket++) {
next = pool->buckets[bucket].free_list; next = pool->buckets[bucket].free_list;
do { do {
while (unlikely(next == POOL_BUSY)) { while (unlikely(next == POOL_BUSY))
__ha_cpu_relax(); next = (void*)pl_wait_new_long((ulong*)&pool->buckets[bucket].free_list, (ulong)next);
next = _HA_ATOMIC_LOAD(&pool->buckets[bucket].free_list);
}
if (next == NULL) if (next == NULL)
break; break;
} while (unlikely((next = _HA_ATOMIC_XCHG(&pool->buckets[bucket].free_list, POOL_BUSY)) == POOL_BUSY)); } while (unlikely((next = _HA_ATOMIC_XCHG(&pool->buckets[bucket].free_list, POOL_BUSY)) == POOL_BUSY));