]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: task: remove TASK_SHARED_WQ and only use t->tid
authorWilly Tarreau <w@1wt.eu>
Wed, 15 Jun 2022 14:48:45 +0000 (16:48 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Jul 2022 17:15:14 +0000 (19:15 +0200)
commit159e3acf5de7afe705dd914b8be709a9309db82e
tree47cec453103502c594283788927b7f0b50d36766
parent3b7a19c2a65abe3f3461da7e57a55eee29d75e7a
MEDIUM: task: remove TASK_SHARED_WQ and only use t->tid

TASK_SHARED_WQ was set upon task creation and never changed afterwards.
Thus if a task was created to run anywhere (e.g. a check or a Lua task),
all its timers would always pass through the shared timers queue with a
lock. Now we know that tid<0 indicates a shared task, so we can use that
to decide whether or not to use the shared queue. The task might be
migrated using task_set_affinity() but it's always dequeued first so
the check will still be valid.

Not only this removes a flag that's difficult to keep synchronized with
the thread ID, but it should significantly lower the load on systems with
many checks. A quick test with 5000 servers and fast checks that were
saturating the CPU shows that the check rate increased by 20% (hence the
CPU usage dropped by 17%). It's worth noting that run_task_lists() almost
no longer appears in perf top now.
dev/flags/flags.c
include/haproxy/task-t.h
include/haproxy/task.h
src/task.c