]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: threads: remove the now unused all_threads_mask and tid_bit
authorWilly Tarreau <w@1wt.eu>
Fri, 15 Jul 2022 15:28:11 +0000 (17:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 Jul 2022 18:25:41 +0000 (20:25 +0200)
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.

include/haproxy/thread.h
src/cfgparse.c
src/haproxy.c
src/thread.c

index 67aefc7a3c959fc42a60e91ce5479bb94079986d..97502c0a6236382ebd61894e9faafaf04f8d687a 100644 (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];
index 2bd498ac763f821c8efd7085c06854045dc3769f..a56052151d523dc166f4d2d50211cd19e4d55cbf 100644 (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
        }
 
index e32707c973b6ccd527102413326f01a11e6b3937..a2a7376730a6bd7771983836a30188a9c9f56e74 100644 (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
index e38b7fea9741f8186815c42e99c84705ef81ce09..cc983a26126d79590563f2c1e08628db7e6953ac 100644 (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,