]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: server: move the lock inside srv_add_idle()
authorWilly Tarreau <w@1wt.eu>
Thu, 6 Nov 2025 12:12:04 +0000 (13:12 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Nov 2025 12:16:24 +0000 (13:16 +0100)
commit5fe4677231cd8adc85d5715bbed306769dd16b70
tree8d066382049afe75de243344b787ce72d314d048
parenta8498cde74ee55b07050c0c0009822f5f0b25008
MINOR: server: move the lock inside srv_add_idle()

Almost all callers of _srv_add_idle() lock the list then call the
function. It's not the most efficient and it requires some care from
the caller to take care of that lock. Let's change this a little bit by
having srv_add_idle() that takes the lock and calls _srv_add_idle() that
is now inlined. This way callers don't have to handle the lock themselves
anymore, and the lock is only taken around the sensitive parts, not the
function call+return.

Interestingly, perf tests show a small perf increase from 2.28-2.32M RPS
to 2.32-2.37M RPS on a 128-thread system.
include/haproxy/server.h
src/connection.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c
src/mux_quic.c
src/mux_spop.c
src/server.c
src/ssl_sock.c