]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: task: add a new task_instant_wakeup() function
authorWilly Tarreau <w@1wt.eu>
Fri, 22 Apr 2022 16:22:03 +0000 (18:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 22 Apr 2022 17:11:59 +0000 (19:11 +0200)
commita4e39890f35e2c5d55f6dc00356a6d7665390a5b
treef2b7e04f9e91eb1dbae15a1f0b32f8809b3b2d2a
parentf6df6b440a0bb22dd6964151b86d6142a8d7d5b5
MINOR: task: add a new task_instant_wakeup() function

This function's purpose is to wake up either a local or remote task,
bypassing the tree-based run queue. It is meant for fast wakeups that
are supposed to be equivalent to those used with tasklets, i.e. a task
had to pause some processing and can complete (typically a resource
becomes available again). In all cases, it's important to keep in mind
that the task must have gone through the regular scheduling path before
being blocked, otherwise the task priorities would be ignored.

The reason for this is that some wakeups are massively inter-thread
(e.g. server queues), that these inter-thread wakeups cause a huge
contention on the shared runqueue lock. A user reported 47% CPU spent
in process_runnable_tasks with only 32 threads and 80k requests in
queues. With this mechanism, purely one-to-one wakeups can avoid
taking the lock thanks to the mt_list used for the shared tasklet
queue.

Right now the shared tasklet queue moves everything to the TL_URGENT
queue. It's not dramatic but it would seem better to have a new shared
list dedicated to tasks, and that would deliver into TL_NORMAL, for an
even better fairness. This could be improved in the future.
include/haproxy/task-t.h
include/haproxy/task.h