]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: queue: revert to regular inter-task wakeups
authorWilly Tarreau <w@1wt.eu>
Thu, 16 Jun 2022 14:10:05 +0000 (16:10 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Jul 2022 17:15:14 +0000 (19:15 +0200)
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").

src/queue.c

index 6933326a6ed05b382d24b71259491e242f6e7550..6e0e13032b127d1fed876c781710443ac15ee7d5 100644 (file)
@@ -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);