]> git.ipfire.org Git - thirdparty/haproxy.git/commit
DEBUG: task: simplify the caller recording in DEBUG_TASK
authorWilly Tarreau <w@1wt.eu>
Tue, 6 Sep 2022 09:11:47 +0000 (11:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 8 Sep 2022 12:30:38 +0000 (14:30 +0200)
commit2830d282e59068b6c2d0c82ce473ec5251e7a2b0
tree99c97819597e97542bd319f5faadb2bfd8018769
parent8d71abf0cd8fa516cc30ba312612e30eb4c09ab4
DEBUG: task: simplify the caller recording in DEBUG_TASK

Instead of storing an index that's swapped at every call, let's use the
two pointers as a shifting history. Now we have a permanent "caller"
field that records the last caller, and an optional prev_caller in the
debug section enabled by DEBUG_TASK that keeps a copy of the previous
caller one. This way, not only it's much easier to follow what's
happening during debugging, but it saves 8 bytes in the struct task in
debug mode and still keeps it under 2 cache lines in nominal mode, and
this will finally be usable everywhere and later in profiling.

The caller_idx was also used as a hint that the entry was freed, in order
to detect wakeup-after-free. This was changed by setting caller to -1
instead and preserving its value in caller[1].

Finally, the operations were made atomic. That's not critical but since
it's used for debugging and race conditions represent a significant part
of the issues in multi-threaded mode, it seems wise to at least eliminate
some possible factors of faulty analysis.
include/haproxy/task-t.h
include/haproxy/task.h