]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use globally assigned thread_id in the isc_hp API
authorOndřej Surý <ondrej@sury.org>
Tue, 16 Feb 2021 15:02:51 +0000 (16:02 +0100)
committerOndřej Surý <ondrej@isc.org>
Fri, 26 Feb 2021 20:14:17 +0000 (21:14 +0100)
Convert the isc_hp API to use the globally available isc_tid_v instead
of locally defined tid_v.  This should solve most of the problems on
machines with many number of cores / CPUs.

(cherry picked from commit bea333f7c92c3ffa1eec25e19e86d0487457365b)

lib/isc/hp.c

index 3ea13bbe24cb87675218df0fef860fe72cf3b624..92d160b3ebda9083dcf31bfae9679133a63fe457 100644 (file)
@@ -62,12 +62,6 @@ static int isc__hp_max_threads = HP_MAX_THREADS;
 /* Maximum number of retired objects per thread */
 static int isc__hp_max_retired = HP_MAX_THREADS * HP_MAX_HPS;
 
-#define TID_UNKNOWN -1
-
-static atomic_int_fast32_t tid_v_base = ATOMIC_VAR_INIT(0);
-
-ISC_THREAD_LOCAL int tid_v = TID_UNKNOWN;
-
 typedef struct retirelist {
        int size;
        uintptr_t *list;
@@ -82,13 +76,8 @@ struct isc_hp {
 };
 
 static inline int
-tid() {
-       if (tid_v == TID_UNKNOWN) {
-               tid_v = atomic_fetch_add(&tid_v_base, 1);
-               REQUIRE(tid_v < isc__hp_max_threads);
-       }
-
-       return (tid_v);
+tid(void) {
+       return (isc_tid_v);
 }
 
 void