]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: queue: update proxy->served once out of the loop
authorWilly Tarreau <w@1wt.eu>
Fri, 18 Jun 2021 16:58:07 +0000 (18:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Jun 2021 16:37:45 +0000 (18:37 +0200)
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.

src/queue.c

index fe082def4cbc3b8490aaeb15a1803dae07b5b012..87ffca58df824c60388877b1afa9af86833bc493 100644 (file)
@@ -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);
 }