From: Willy Tarreau Date: Thu, 16 Jun 2022 14:10:05 +0000 (+0200) Subject: MEDIUM: queue: revert to regular inter-task wakeups X-Git-Tag: v2.7-dev2~139 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fdacdddaff55c754b24813f4832518b87791efc;p=thirdparty%2Fhaproxy.git MEDIUM: queue: revert to regular inter-task wakeups Now that the inter-task wakeups are cheap, there's no point in using task_instant_wakeup() anymore when dequeueing tasks. The use of the regular task_wakeup() is sufficient there and will preserve a better fairness: the test that went from 40k to 570k RPS now gives 580k RPS (down from 585k RPS with previous commit). This essentially reverts commit 27fab1dcb ("MEDIUM: queue: use tasklet_instant_wakeup() to wake tasks"). --- diff --git a/src/queue.c b/src/queue.c index 6933326a6e..6e0e13032b 100644 --- a/src/queue.c +++ b/src/queue.c @@ -322,7 +322,7 @@ static int pendconn_process_next_strm(struct server *srv, struct proxy *px, int * under us since the task will need to take the lock anyway and to wait * if it wakes up on a different thread. */ - task_instant_wakeup(pp->strm->task, TASK_WOKEN_RES); + task_wakeup(pp->strm->task, TASK_WOKEN_RES); HA_SPIN_UNLOCK(QUEUE_LOCK, &pp->del_lock); _HA_ATOMIC_DEC(&px->queue.length); @@ -343,7 +343,7 @@ static int pendconn_process_next_strm(struct server *srv, struct proxy *px, int * under us since the task will need to take the lock anyway and to wait * if it wakes up on a different thread. */ - task_instant_wakeup(p->strm->task, TASK_WOKEN_RES); + task_wakeup(p->strm->task, TASK_WOKEN_RES); __pendconn_unlink_srv(p); _HA_ATOMIC_DEC(&srv->queue.length); @@ -497,7 +497,7 @@ int pendconn_redistribute(struct server *s) __pendconn_unlink_srv(p); p->strm_flags &= ~(SF_DIRECT | SF_ASSIGNED); - task_instant_wakeup(p->strm->task, TASK_WOKEN_RES); + task_wakeup(p->strm->task, TASK_WOKEN_RES); xferred++; } HA_SPIN_UNLOCK(QUEUE_LOCK, &s->queue.lock); @@ -541,7 +541,7 @@ int pendconn_grab_from_px(struct server *s) __pendconn_unlink_prx(p); p->target = s; - task_instant_wakeup(p->strm->task, TASK_WOKEN_RES); + task_wakeup(p->strm->task, TASK_WOKEN_RES); xferred++; } HA_SPIN_UNLOCK(QUEUE_LOCK, &s->proxy->queue.lock);