From: Willy Tarreau Date: Tue, 14 Jun 2022 08:43:01 +0000 (+0200) Subject: MINOR: tinfo: remove the global thread ID bit (tid_bit) X-Git-Tag: v2.7-dev1~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a85a958dd619defb86810492db129e8cc74fd0c;p=thirdparty%2Fhaproxy.git MINOR: tinfo: remove the global thread ID bit (tid_bit) Each thread has its own local thread id and its own global thread id, in addition to the masks corresponding to each. Once the global thread ID can go beyond 64 it will not be possible to have a global thread Id bit anymore, so better start to remove it and use only the local one from the struct thread_info. --- diff --git a/include/haproxy/thread.h b/include/haproxy/thread.h index dfdb33387f..a66180ee56 100644 --- a/include/haproxy/thread.h +++ b/include/haproxy/thread.h @@ -223,14 +223,14 @@ extern THREAD_LOCAL unsigned int tgid; /* The thread group id (starts at 1) static inline void ha_set_thread(const struct thread_info *thr) { if (thr) { - BUG_ON(!thr->tid_bit); + BUG_ON(!thr->ltid_bit); BUG_ON(!thr->tg); BUG_ON(!thr->tg->tgid); ti = thr; tg = thr->tg; tid = thr->tid; - tid_bit = thr->tid_bit; + tid_bit = thr->ltid_bit; th_ctx = &ha_thread_ctx[tid]; tgid = tg->tgid; } else { diff --git a/include/haproxy/tinfo-t.h b/include/haproxy/tinfo-t.h index 4f3b9f629c..b2395a4d5f 100644 --- a/include/haproxy/tinfo-t.h +++ b/include/haproxy/tinfo-t.h @@ -62,7 +62,7 @@ struct tgroup_info { struct thread_info { const struct tgroup_info *tg; /* config of the thread-group this thread belongs to */ uint tid, ltid; /* process-wide and group-wide thread ID (start at 0) */ - ulong tid_bit, ltid_bit; /* bit masks for the tid/ltid */ + ulong ltid_bit; /* bit masks for the tid/ltid */ /* pad to cache line (64B) */ char __pad[0]; /* unused except to check remaining room */ diff --git a/src/thread.c b/src/thread.c index 7318de973c..9a0811bfd3 100644 --- a/src/thread.c +++ b/src/thread.c @@ -1078,8 +1078,6 @@ int thread_map_to_groups() for (t = 0; t < global.nbthread; t++) { ha_thread_info[t].tid = t; ha_thread_info[t].ltid = t - ha_thread_info[t].tg->base; - - ha_thread_info[t].tid_bit = 1UL << ha_thread_info[t].tid; ha_thread_info[t].ltid_bit = 1UL << ha_thread_info[t].ltid; }