]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: clock: use ltid_bit in clock_report_idle()
authorWilly Tarreau <w@1wt.eu>
Mon, 27 Jun 2022 14:22:22 +0000 (16:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Jul 2022 17:15:15 +0000 (19:15 +0200)
Since commit cc7a11ee3 ("MINOR: threads: set the tid, ltid and their bit
in thread_cfg") we ought not use (1UL << thr) to get the group mask for
thread <thr>, but (ha_thread_info[thr].ltid_bit). clock_report_idle()
needs this.

This also implies not using all_threads_mask anymore but taking the mask
from the tgroup since it becomes relative now.

src/clock.c

index 3b9e9ff64a4977cff597d7d8ca7b43fc5ca9042b..099057f7df9112551ee852caea2b36820d8b513f 100644 (file)
@@ -276,7 +276,8 @@ uint clock_report_idle(void)
        uint thr;
 
        for (thr = 0; thr < MAX_THREADS; thr++) {
-               if (!(all_threads_mask & (1UL << thr)))
+               if (!ha_thread_info[thr].tg ||
+                   !(ha_thread_info[thr].tg->threads_enabled & ha_thread_info[thr].ltid_bit))
                        continue;
                total += HA_ATOMIC_LOAD(&ha_thread_ctx[thr].idle_pct);
                rthr++;