]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MAJOR: fd: compute the new fd polling state out of the fd lock
authorWilly Tarreau <w@1wt.eu>
Wed, 17 Jan 2018 20:25:57 +0000 (21:25 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 5 Feb 2018 15:02:22 +0000 (16:02 +0100)
commit7ac0e35f236db550f46e62f5a7b79f7fd3a64078
tree2c12c42b434fa1ecac2f3432a7087867353b9a09
parent1256836ebf4f1563bade396ec4f9715fc4c9f044
MAJOR: fd: compute the new fd polling state out of the fd lock

Each fd_{may|cant|stop|want}_{recv|send} function sets or resets a
single bit at once, then recomputes the need for updates, and then
the new cache state. Later, pollers will compute the new polling
state based on the resulting operations here. In fact the conditions
are so simple that they can be performed by a single "if", or sometimes
even optimized away.

This means that in practice a simple compare-and-swap operation if often
enough to set the new value inluding the new polling state, and that only
the cache and fdupdt have to be performed under the lock. Better, for the
most common operations (fd_may_{recv,send}, used by the pollers), a simple
atomic OR is needed.

This patch does this for the fd_* functions above and it doesn't yet
remove the now useless fd_compute_new_polling_status() because it's still
used by other pollers. A pure connection rate test shows a 1% performance
increase.
include/proto/fd.h