]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tinfo: add the mask of enabled threads in each group
authorWilly Tarreau <w@1wt.eu>
Fri, 24 Jun 2022 13:18:49 +0000 (15:18 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Jul 2022 17:15:14 +0000 (19:15 +0200)
In order to replace the global "all_threads_mask" we'll need to have an
equivalent per group. Take this opportunity for calling it threads_enabled
and make sure which ones are counted there (in case in the future we allow
to stop some).

include/haproxy/tinfo-t.h
src/haproxy.c
src/thread.c

index 5f0d7942604a47c79ba6c8613771922217449f86..f7a7494b6955e676f5b94db19308fc9dd9c8281c 100644 (file)
@@ -52,6 +52,7 @@ enum {
  * at 1 so tgroup[0] describes thread group 1.
  */
 struct tgroup_info {
+       ulong threads_enabled;     /* mask of threads enabled in this group */
        uint base;                 /* first thread in this group */
        uint count;                /* number of threads in this group */
        ulong tgid_bit;            /* bit corresponding to the tgroup ID */
index 1df98d615983a9448a7fc804e28480a9bf4e5431..79d40ab1b772015226b2fc57614510091a2c4e3f 100644 (file)
@@ -2973,6 +2973,7 @@ static void *run_thread_poll_loop(void *data)
                ptff->fct();
 
 #ifdef USE_THREAD
+       _HA_ATOMIC_AND(&ha_tgroup_info[ti->tgid].threads_enabled, ~ti->ltid_bit);
        _HA_ATOMIC_AND(&all_threads_mask, ~tid_bit);
        if (tid > 0)
                pthread_exit(NULL);
index dedde13b4c9e2da684fd23eb1750b5fbc9eee565..d895bbcdab5ff3246b5e083a999d2a350b8df426 100644 (file)
@@ -1082,6 +1082,11 @@ int thread_map_to_groups()
                ha_thread_info[t].ltid_bit = 1UL << ha_thread_info[t].ltid;
        }
 
+       for (g = 0; g < global.nbtgroups; g++) {
+               ha_tgroup_info[g].threads_enabled = nbits(ha_tgroup_info[g].count);
+
+       }
+
        return 0;
 }