]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: mt_list: Reduce the max number of loops with exponential backoff
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 21 Mar 2025 09:56:40 +0000 (09:56 +0000)
committerOlivier Houchard <cognet@ci0.org>
Fri, 21 Mar 2025 10:30:59 +0000 (11:30 +0100)
Reduce the max number of loops in the mt_list code while waiting for
a lock to be available with exponential backoff. It's been observed that
the current value led to severe performances degradation at least on
some hardware, hopefully this value will be acceptable everywhere.

include/import/mt_list.h

index 85863fa3451eef696158fb18206c7cc6ca2bda11..86d44e51784b9891a72ffa893f5f606639a72741 100644 (file)
@@ -225,7 +225,7 @@ static inline __attribute__((always_inline)) unsigned long mt_list_cpu_relax(uns
        /* limit maximum wait time for unlucky threads */
        loop = mt_list_wait(loop);
 
-       for (loop &= 0x7fffff; loop >= 32; loop--) {
+       for (loop &= 0xfffff; loop >= 32; loop--) {
 #if defined(__x86_64__)
                /* This is a PAUSE instruction on x86_64 */
                asm volatile("rep;nop\n");