diff --git a/include/haproxy/tinfo-t.h b/include/haproxy/tinfo-t.h index 5f0d79426..f7a7494b6 100644 --- a/include/haproxy/tinfo-t.h +++ b/include/haproxy/tinfo-t.h @@ -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 */ diff --git a/src/haproxy.c b/src/haproxy.c index 1df98d615..79d40ab1b 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -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); diff --git a/src/thread.c b/src/thread.c index dedde13b4..d895bbcda 100644 --- a/src/thread.c +++ b/src/thread.c @@ -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; }