]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: tasks: Remove the per-thread group wait queue
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 28 Apr 2026 16:46:54 +0000 (18:46 +0200)
committerOlivier Houchard <cognet@ci0.org>
Fri, 12 Jun 2026 09:49:09 +0000 (11:49 +0200)
commit0988b9c7730663e24c0809879e40ffcdb245c1e9
tree6f3646cfbaaf08c290e2d4595c378d4fe7027158
parentc9f3ddcb1e3da257a34a3bd2b90afb7c93863be9
MEDIUM: tasks: Remove the per-thread group wait queue

Totally remove the per-thread group wait queue. This was potentially a
source of contention, because there were only a global lock for all
those wait queues.
Instead, for shared tasks, there is now the concept of ownership for the
task. When a task is in the wait queue, run queue, or is running on that
particular thread, the task's tid is set to -2 - thread_tid, and only
that thread will be responsible for it until it is no longer running,
and in none of its queue.
When a shared task is scheduled to be run at a later time, if its
current tid is -1, then the current thread will take ownership, and put
it in its own wait queue. If it is already owned, then TASK_WOKEN_WQ is
added to the task's state, and a task_wakeup() is done, so that the
owner thread will add it in its wait queue.
If there is any owner, then a task_wakeup() will just add the task to
the owner's runqueue, otherwise the current thread will become the
owner.
include/haproxy/task-t.h
include/haproxy/task.h
src/task.c