From: Willy Tarreau Date: Fri, 18 Jun 2021 16:58:07 +0000 (+0200) Subject: MINOR: queue: update proxy->served once out of the loop X-Git-Tag: v2.5-dev1~61 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e92a31783b545dd58c4be6c588808763e0042bc;p=thirdparty%2Fhaproxy.git MINOR: queue: update proxy->served once out of the loop It's not needed during all these operations and doesn't even affect queueing in the LB algo, so we can safely update it out of the loop and the lock. --- diff --git a/src/queue.c b/src/queue.c index fe082def4c..87ffca58df 100644 --- a/src/queue.c +++ b/src/queue.c @@ -351,10 +351,9 @@ void process_srv_queue(struct server *s, int server_locked) if (!pc) break; - done = 1; + done++; _HA_ATOMIC_INC(&s->served); - _HA_ATOMIC_INC(&p->served); stream_add_srv_conn(pc->strm, s); task_wakeup(pc->strm->task, TASK_WOKEN_RES); @@ -363,6 +362,8 @@ void process_srv_queue(struct server *s, int server_locked) if (!server_locked) HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock); + _HA_ATOMIC_ADD(&p->served, done); + if (done && p->lbprm.server_take_conn) p->lbprm.server_take_conn(s, server_locked); }