MINOR: queue: factor out the proxy/server queuing code (v2)
authorWilly Tarreau <w@1wt.eu>
Fri, 18 Jun 2021 08:21:20 +0000 (10:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Jun 2021 08:52:31 +0000 (10:52 +0200)
commit12529c0ed31cbdf1c83f36db3a52d5ff84cab3b7
tree76a05d231c06f381015e58c161cd2e8c41c71aae
parenta0e9c55ab1b13b721d8645ac5897873ce63f5056
MINOR: queue: factor out the proxy/server queuing code (v2)

The code only differed by the nbpend_max counter. Let's have a pointer
to it and merge the two variants to always use a generic queue. It was
initially considered to put the max inside the queue structure itself,
but the stats support clearing values and maxes and this would have been
the only counter having to be handled separately there. Given that we
don't need this max anywhere outside stats, let's keep it where it is
and have a pointer to it instead.

The CAS loop to update the max remains. It was naively thought that it
would have been faster without atomic ops inside the lock, but this is
not the case for the simple reason that it is a max, it converges very
quickly and never has to perform the check anymore. Thus this code is
better out of the lock.

The queue_idx is still updated inside the lock since that's where the
idx is updated, though it could be performed using atomic ops given
that it's only used to roughly count places for logging.
src/queue.c