MEDIUM: tasks: automatically requeue into the bulk queue an already running tasklet

When a tasklet re-runs itself such as in this chain:

   si_cs_io_cb -> si_cs_process -> si_notify -> si_chk_rcv

then we know it can easily clobber the run queue and harm latency. Now
what the scheduler does when it detects this is that such a tasklet is
automatically placed into the bulk list so that it's processed with the
remaining CPU bandwidth only. Thanks to this the CLI becomes instantly
responsive again even under heavy stress at 50 Gbps over 40kcon and
100% CPU on 16 threads.
This commit is contained in:
Willy Tarreau 2020-01-30 18:59:43 +01:00
parent a62917b890
commit a17664d829

View File

@ -245,7 +245,10 @@ static inline void tasklet_wakeup(struct tasklet *tl)
if (likely(tl->tid < 0)) {
/* this tasklet runs on the caller thread */
if (LIST_ISEMPTY(&tl->list)) {
LIST_ADDQ(&task_per_thread[tid].tasklets[TL_URGENT], &tl->list);
if (tl->state & TASK_RUNNING)
LIST_ADDQ(&task_per_thread[tid].tasklets[TL_BULK], &tl->list);
else
LIST_ADDQ(&task_per_thread[tid].tasklets[TL_URGENT], &tl->list);
_HA_ATOMIC_ADD(&tasks_run_queue, 1);
}
} else {