]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: fd/threads: only grab the fd's lock if the FD has more than one thread
authorWilly Tarreau <w@1wt.eu>
Mon, 15 Oct 2018 07:44:46 +0000 (09:44 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 15 Oct 2018 11:25:06 +0000 (13:25 +0200)
commit87d54a9a6dee5170c7c12e1bd3f43bd9f49634e7
treeb2b8bb6ec26cde5946aca0e366b73422228a6a0d
parent9504dd64c6a92de1c20f6a53fb25c4e27ba6683d
MEDIUM: fd/threads: only grab the fd's lock if the FD has more than one thread

The vast majority of FDs are only seen by one thread. Currently the lock
on FDs costs a lot because it's touched often, though there should be very
little contention. This patch ensures that the lock is only grabbed if the
FD is shared by more than one thread, since otherwise the situation is safe.
Doing so resulted in a 15% performance boost on a 12-threads test.
include/proto/fd.h
src/fd.c