MEDIUM: threads: detect excessive thread counts vs cpu-map
authorWilly Tarreau <w@1wt.eu>
Mon, 4 Sep 2023 15:36:20 +0000 (17:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 4 Sep 2023 17:39:17 +0000 (19:39 +0200)
commit86854dd0325b1ae4cbd2d0bed8f7bec3791f56c7
treef3ff27c95b42e4eedc7360dcf6c67c0694e7d517
parent8357f950cbb33640a6b940fe1fc33120a5ab177d
MEDIUM: threads: detect excessive thread counts vs cpu-map

This detects when there are more threads bound via cpu-map than CPUs
enabled in cpu-map, or when there are more total threads than the total
number of CPUs available at boot (for unbound threads) and configured
for bound threads. In this case, a warning is emitted to explain the
problems it will cause, and explaining how to address the situation.

Note that some configurations will not be detected as faulty because
the algorithmic complexity to resolve all arrangements grows in O(N!).
This means that having 3 threads on 2 CPUs and one thread on 2 CPUs
will not be detected as it's 4 threads for 4 CPUs. But at least configs
such as T0:(1,4) T1:(1,4) T2:(2,4) T3:(3,4) will not trigger a warning
since they're valid.
include/haproxy/thread.h
src/haproxy.c
src/thread.c