]> git.kaiwu.me - haproxy.git/commit
MEDIUM: tasks: Redispatch shared tasks when the thread is loaded
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 9 Jun 2026 11:01:09 +0000 (13:01 +0200)
committerOlivier Houchard <cognet@ci0.org>
Fri, 12 Jun 2026 09:49:09 +0000 (11:49 +0200)
commitb9aa1c0e644a1a97f7b2ba780b8e17f841a225e4
treeee85d3da4d02ed04526085029dec6c49c16a657c
parentaaee6c463cfa5ba4068c953ac658a0dfceda00db
MEDIUM: tasks: Redispatch shared tasks when the thread is loaded

Now that there is no longer a shared wake queue, chances are if a shared task
is scheduled, it will always end up on the same thread. In
wake_expired_tasks(), when a task has to be waken up, randomly look to
three other threads, and if the runqueue of the current thread is at least
two time bigger than the runqueue of one of the other threads, then give
that task to that thread, so that our load gets reduced.
If we're giving the task to another thread, then we have to add the
TASK_RUNNING flag until we waked it up, otherwise the other thread could
just run it, if it gets waken up from another path, and free it while
we're still not done with it.
2 times has been chosen somewhat arbitrarily, and may be tweaked at a
later date if deemed not optimal.
include/haproxy/task.h
src/task.c