]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: fd: optimize fd_claim_tgid() for use in fd_insert()
authorWilly Tarreau <w@1wt.eu>
Thu, 13 Apr 2023 13:22:42 +0000 (15:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 13 Apr 2023 14:57:51 +0000 (16:57 +0200)
commit4d882bd80089eac21d949bdb6d10a8700fea32c6
treea9e213e0d8e5ca678acf2967c06d2dd7bfc0fe7a
parent97da942ba6392086d3165835564089cd71cb7b23
MINOR: fd: optimize fd_claim_tgid() for use in fd_insert()

fd_claim_tgid() uses a CAS to set the desired TGID on the FD. It's only
called from fd_insert() where in the vast majority of cases, the tgid
and refcount are zero before the call. However the loop was optimized
for the case where it was equal to the desired TGID, systematically
causing one extra round in the loop there. Better start assuming a
zero value.
include/haproxy/fd.h