CLEANUP: threads: remove the now unused all_threads_mask and tid_bit

Since these are not used anymore, let's now remove them. Given the
number of places where we're using ti->ldit_bit, maybe an equivalent
might be useful though.
This commit is contained in:
Willy Tarreau 2022-07-15 17:28:11 +02:00
parent cfdd20a0b2
commit c6b596dcce
4 changed files with 0 additions and 16 deletions

View File

@ -55,7 +55,6 @@ extern int thread_cpus_enabled_at_boot;
/* Only way found to replace variables with constants that are optimized away
* at build time.
*/
enum { all_threads_mask = 1UL };
enum { all_tgroups_mask = 1UL };
enum { tid_bit = 1UL };
enum { tid = 0 };
@ -176,11 +175,9 @@ void wait_for_threads_completion();
void set_thread_cpu_affinity();
unsigned long long ha_get_pthread_id(unsigned int thr);
extern volatile unsigned long all_threads_mask;
extern volatile unsigned long all_tgroups_mask;
extern volatile unsigned int rdv_requests;
extern volatile unsigned int isolated_thread;
extern THREAD_LOCAL unsigned long tid_bit; /* The bit corresponding to the thread id */
extern THREAD_LOCAL unsigned int tid; /* The thread id */
extern THREAD_LOCAL unsigned int tgid; /* The thread group id (starts at 1) */
@ -201,13 +198,11 @@ static inline void ha_set_thread(const struct thread_info *thr)
tg = thr->tg;
tid = thr->tid;
tgid = thr->tgid;
tid_bit = 1UL << tid; /* FIXME: must become thr->ltid_bit */
th_ctx = &ha_thread_ctx[tid];
tg_ctx = &ha_tgroup_ctx[tgid-1];
} else {
tgid = 1;
tid = 0;
tid_bit = 1;
ti = &ha_thread_info[0];
tg = &ha_tgroup_info[0];
th_ctx = &ha_thread_ctx[0];

View File

@ -2495,7 +2495,6 @@ int check_config_validity()
global.nbthread = numa_cores ? numa_cores :
thread_cpus_enabled_at_boot;
}
all_threads_mask = nbits(global.nbthread);
#endif
}

View File

@ -835,11 +835,6 @@ static void mworker_loop()
global.nbthread = 1;
#ifdef USE_THREAD
tid_bit = 1;
all_threads_mask = 1;
#endif
jobs++; /* this is the "master" job, we want to take care of the
signals even if there is no listener so the poll loop don't
leave */
@ -2997,7 +2992,6 @@ static void *run_thread_poll_loop(void *data)
_HA_ATOMIC_AND(&all_tgroups_mask, ~tg->tgid_bit);
if (!_HA_ATOMIC_AND_FETCH(&tg_ctx->stopping_threads, ~ti->ltid_bit))
_HA_ATOMIC_AND(&stopping_tgroup_mask, ~tg->tgid_bit);
_HA_ATOMIC_AND(&all_threads_mask, ~tid_bit);
if (tid > 0)
pthread_exit(NULL);
#endif

View File

@ -63,13 +63,11 @@ THREAD_LOCAL struct thread_ctx *th_ctx = &ha_thread_ctx[0];
#ifdef USE_THREAD
volatile unsigned long all_threads_mask __read_mostly = 1; // nbthread 1 assumed by default
volatile unsigned long all_tgroups_mask __read_mostly = 1; // nbtgroup 1 assumed by default
volatile unsigned int rdv_requests = 0; // total number of threads requesting RDV
volatile unsigned int isolated_thread = ~0; // ID of the isolated thread, or ~0 when none
THREAD_LOCAL unsigned int tgid = 1; // thread ID starts at 1
THREAD_LOCAL unsigned int tid = 0;
THREAD_LOCAL unsigned long tid_bit = (1UL << 0);
int thread_cpus_enabled_at_boot = 1;
static pthread_t ha_pthread[MAX_THREADS] = { };
@ -1261,8 +1259,6 @@ static int cfg_parse_nbthread(char **args, int section_type, struct proxy *curpx
memprintf(err, "'%s' value must be between 1 and %d (was %ld)", args[0], MAX_THREADS, nbthread);
return -1;
}
all_threads_mask = nbits(nbthread);
#endif
HA_DIAG_WARNING_COND(global.nbthread,