]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MAJOR: poller: only touch/inspect the update_mask under tgid protection
authorWilly Tarreau <w@1wt.eu>
Sat, 9 Jul 2022 21:55:43 +0000 (23:55 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 Jul 2022 18:16:30 +0000 (20:16 +0200)
commit1f947cb39ed92036131d71ea06404429208c4be3
treef34d56b1df21c1c9c64029abe4a0018676df40fd
parentd95f18fa39e6ece48a3fe6dc45c5030f4e0827db
MAJOR: poller: only touch/inspect the update_mask under tgid protection

With thread groups and group-local masks, the update_mask cannot be
touched nor even checked if it may change below us. In order to avoid
this, we have to grab a reference to the FD's tgid before checking the
update mask. The operations are cheap enough so that we don't notice it
in performance tests. This is expected because the risk of meeting a
reassigned FD during an update remains very low.

It's worth noting that the tgid cannot be trusted during startup nor
during soft-stop since that may come from anywhere at the moment. Since
soft-stop runs under thread isolation we use that hint to decide whether
or not to check that the FD's tgid matches the current one.

The modification is applied to the 3 thread-aware pollers, i.e. epoll,
kqueue, and evports. Also one poll_drop counter was missing for shared
updates, though it might be hard to trigger it.

With this change applied, thread groups are usable in benchmarks.
src/ev_epoll.c
src/ev_evports.c
src/ev_kqueue.c