]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: checks: also consider the thread's queue for rebalancing
authorWilly Tarreau <w@1wt.eu>
Thu, 31 Aug 2023 15:51:00 +0000 (17:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Sep 2023 12:00:04 +0000 (14:00 +0200)
Let's also check for other threads when the current one is queueing,
let's not wait for the load to be high. Now this totally eliminates
differences between threads.

src/check.c

index de8ffc3763f4ab4c2340a4b267855652b9306e34..86af008747ff78d13e2fecfbe4a9361b58c31d28 100644 (file)
@@ -1205,7 +1205,8 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
                         * other thread.
                         */
                        while (attempts-- > 0 &&
-                              my_load >= 3 && _HA_ATOMIC_LOAD(&th_ctx->active_checks) >= 3) {
+                              (!LIST_ISEMPTY(&th_ctx->queued_checks) || my_load >= 3) &&
+                              _HA_ATOMIC_LOAD(&th_ctx->active_checks) >= 3) {
                                uint new_tid  = statistical_prng_range(global.nbthread);
 
                                if (new_tid == tid)