]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: queues: use __ha_cpu_relax() on failed CAS.
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 28 Jan 2025 15:18:40 +0000 (16:18 +0100)
committerOlivier Houchard <cognet@ci0.org>
Tue, 28 Jan 2025 15:00:19 +0000 (16:00 +0100)
Make sure we call __ha_cpu_relax() if we fail a CAS, to help with
contention.

src/queue.c

index 0bfdd09f026e5de6794f6233d1f01ffaac8b6db3..2e8e861a57b06f35ba319f3b22ad69dcbfd50ebc 100644 (file)
@@ -453,7 +453,7 @@ int process_srv_queue(struct server *s)
                                        else
                                                new_served++;
                                }
-                       } while (!_HA_ATOMIC_CAS(&s->per_tgrp[tgid - 1].last_other_tgrp_served, &old_served, new_served));
+                       } while (!_HA_ATOMIC_CAS(&s->per_tgrp[tgid - 1].last_other_tgrp_served, &old_served, new_served) && __ha_cpu_relax());
                        cur_tgrp = new_served;
                        to_dequeue = 1;
                } else {