]> git.kaiwu.me - haproxy.git/commit
MEDIUM: sched: do not punish self-waking tasklets if TASK_WOKEN_ANY
authorWilly Tarreau <wtarreau@haproxy.com>
Sat, 21 Mar 2026 14:58:59 +0000 (14:58 +0000)
committerWilly Tarreau <w@1wt.eu>
Mon, 23 Mar 2026 05:57:12 +0000 (06:57 +0100)
commit282b9b7d167cff0d89993a10aacd4f9f9149d9e6
tree3e0da33001df463cc1aa57bd7170eb6e63f97efa
parent6982c2539f11c8e64368043b58e537b86cf5a7c5
MEDIUM: sched: do not punish self-waking tasklets if TASK_WOKEN_ANY

Self-waking tasklets are currently punished and go to the BULK list.
However it's a problem with muxes or the stick-table purge that just
yield and wake themselves up to limit the latency they cause to the
rest of the process, because by doing so to help others, they punish
themselves. Let's check if any TASK_WOKEN_ANY flag is present on
the tasklet and stop sending tasks presenting such a flag to TL_BULK.
Since tasklet_wakeup() by default passes TASK_WOKEN_OTHER, it means
that such tasklets will no longer be punished. However, tasks which
only want a best-effort wakeup can simply pass 0.

It's worth noting that a comparison was made between going into
TL_BULK at all and only setting the TASK_SELF_WAKING flag, and
it shows that the average latencies are ~10% better when entirely
avoiding TL_BULK in this case.
src/task.c