2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

Use globally assigned thread_id in the isc_hp API

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.
This commit is contained in:
Ondřej Surý 2021-02-16 16:02:51 +01:00
parent cbbecfcc82
commit bea333f7c9

View 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);
static thread_local int tid_v = TID_UNKNOWN;
typedef struct retirelist {
int size;
uintptr_t *list;
@ -83,12 +77,7 @@ struct isc_hp {
static inline int
tid(void) {
if (tid_v == TID_UNKNOWN) {
tid_v = atomic_fetch_add(&tid_v_base, 1);
REQUIRE(tid_v < isc__hp_max_threads);
}
return (tid_v);
return (isc_tid_v);
}
void