From: Willy Tarreau Date: Thu, 28 May 2026 15:19:44 +0000 (+0200) Subject: CLEANUP: thread: indicate when max-threads-per-group is ignored X-Git-Tag: v3.4.0~55 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=f91b1ce9af72cff392283cdf29b24471fc6b917f;p=thirdparty%2Fhaproxy.git CLEANUP: thread: indicate when max-threads-per-group is ignored Since it's easy to get caught by some parameters being ignored, let's detect when mtpg was explicitly set and report a notice if it is ignored due to thread-groups being set. For this we need to avoid presetting the value in the global section and only set it when entering function thread_detect_count(), which is OK since the value cannot be used before. --- diff --git a/src/haproxy.c b/src/haproxy.c index 1060fbc05..3f0e097bf 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -210,7 +210,6 @@ struct global global = { #endif /* by default allow clients which use a privileged port for TCP only */ .clt_privileged_ports = HA_PROTO_TCP, - .maxthrpertgroup = DEF_MAX_THREADS_PER_GROUP, /* others NULL OK */ }; diff --git a/src/thread.c b/src/thread.c index bb733a602..94b7b8dd7 100644 --- a/src/thread.c +++ b/src/thread.c @@ -1682,8 +1682,17 @@ void thread_detect_count(void) if (global.nbtgroups) { grp_min = grp_max = global.nbtgroups; /* ignore max-threads-per-group if thread-groups is configured */ + if (global.maxthrpertgroup) + ha_notice("max-threads-per-group is used to automatically calculate the optimal number of thread groups. It is ignored when thread-groups is set.\n"); global.maxthrpertgroup = MAX_THREADS_PER_GROUP; } + else { + /* set the default max-threads-per-group to calculate the + * optimal number of groups. + */ + if (!global.maxthrpertgroup) + global.maxthrpertgroup = DEF_MAX_THREADS_PER_GROUP; + } #if defined(USE_THREAD) /* Adjust to boot settings if not forced */