MINOR: tinfo: add the mask of enabled threads in each group

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).
This commit is contained in:
Willy Tarreau 2022-06-24 15:18:49 +02:00
parent 60fe4a95a2
commit 377e37a80f
3 changed files with 7 additions and 0 deletions

View 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 */

View 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);

View 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;
}