From: Willy Tarreau Date: Thu, 25 Jun 2026 08:51:42 +0000 (+0200) Subject: MINOR: task: do not try to redistribute the WQ when single-threaded X-Git-Tag: v3.5-dev1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78cc7dacbb3f32a1ebdd46e1339d1c2317fdd851;p=thirdparty%2Fhaproxy.git MINOR: task: do not try to redistribute the WQ when single-threaded When running with nbthread=1, we still try to redistribute once, it fails (new_tid=tid) and leaves the loop. That's just a waste for no reason. Let's condition the redispatch to the presence of at least another thread. --- diff --git a/src/task.c b/src/task.c index 8eabb4633..055f26d22 100644 --- a/src/task.c +++ b/src/task.c @@ -388,7 +388,7 @@ void wake_expired_tasks() * If it's a shared task, see whether we should hand it * to a less loaded thread. */ - if (task->tid < 0) { + if (unlikely(task->tid < 0) && global.nbthread > 1) { int attempts = MIN(global.nbthread, 3); while (attempts-- > 0) { uint new_tid = statistical_prng_range(global.nbthread);