]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: debug: check the match count in __BUG_ON_ONCE() and not in complain()
authorWilly Tarreau <w@1wt.eu>
Mon, 10 Aug 2026 14:50:39 +0000 (16:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 13 Aug 2026 15:43:30 +0000 (17:43 +0200)
commitc627ed7af386d4e90628f20f5dacfc903863da7d
treed69ed7888c8e02dbf67eb8a0827883d87e79890f
parent5be86177a88b419e2402bea27a2ef38e9ba5e946
MINOR: debug: check the match count in __BUG_ON_ONCE() and not in complain()

The fix in commit 7a78d6c600 ("BUG/MINOR: debug: only dump the trace once
in __BUG_ON_ONCE()") warned that it's not strictly atomic, but we could
do better and take this opportunity for cleaning the code: use a fetch-add
in __BUG_ON_ONCE() and pass NULL to complain(), which thus no longer has
any call place requiring it to check a counter. This only very slightly
inflates the code (~138B) since each BUG_ON_ONCE() now has to load 1,
xadd(), check the return value instead of leaving it to complain(), but
this is totally marginal compared to the benefits.

This can even be backported where the fix above is backported if needed.
include/haproxy/bug.h