mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-20 04:37:04 +00:00
MINOR: freq_ctr: add cpu_relax in the rotation loop of update_freq_ctr_period()
When counters are rotated, there is contention between the threads which can slow down the operation of the thread performing the rotation. Let's apply a cpu_relax there to let the first thread finish faster.
This commit is contained in:
parent
fc6323ad82
commit
6339c19cac
@ -50,7 +50,7 @@ static inline unsigned int update_freq_ctr_period(struct freq_ctr *ctr,
|
||||
|
||||
/* remove the bit, used for the lock */
|
||||
curr_tick &= ~1;
|
||||
} while (!_HA_ATOMIC_CAS(&ctr->curr_tick, &curr_tick, curr_tick | 0x1));
|
||||
} while (!_HA_ATOMIC_CAS(&ctr->curr_tick, &curr_tick, curr_tick | 0x1) && __ha_cpu_relax());
|
||||
__ha_barrier_atomic_store();
|
||||
|
||||
if (now_ms_tmp - curr_tick >= period) {
|
||||
|
Loading…
Reference in New Issue
Block a user