mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-02 15:45:25 +00:00
Add ISC_TID_MAX with default being 512 threads
The ISC_TID_MAX variable allows other units to declare static arrays with this as size for per-thread/per-loop variables.
This commit is contained in:
@@ -946,6 +946,8 @@ parse_command_line(int argc, char *argv[]) {
|
|||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
create_managers(void) {
|
create_managers(void) {
|
||||||
|
bool capped = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the default named_g_cpus if it was not set from the command line
|
* Set the default named_g_cpus if it was not set from the command line
|
||||||
*/
|
*/
|
||||||
@@ -954,11 +956,19 @@ create_managers(void) {
|
|||||||
named_g_cpus = named_g_cpus_detected;
|
named_g_cpus = named_g_cpus_detected;
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
|
if (named_g_cpus > ISC_TID_MAX) {
|
||||||
ISC_LOG_INFO, "found %u CPU%s, using %u worker thread%s",
|
capped = true;
|
||||||
named_g_cpus_detected,
|
named_g_cpus = ISC_TID_MAX;
|
||||||
named_g_cpus_detected == 1 ? "" : "s", named_g_cpus,
|
}
|
||||||
named_g_cpus == 1 ? "" : "s");
|
|
||||||
|
isc_log_write(
|
||||||
|
NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
|
||||||
|
"found %u CPU%s, using %u worker thread%s%s",
|
||||||
|
named_g_cpus_detected, named_g_cpus_detected == 1 ? "" : "s",
|
||||||
|
named_g_cpus, named_g_cpus == 1 ? "" : "s",
|
||||||
|
capped ? " (recompile with -DISC_TID_MAX=<n> to raise the "
|
||||||
|
"thread count limit)"
|
||||||
|
: "");
|
||||||
|
|
||||||
isc_managers_create(&named_g_mctx, named_g_cpus, &named_g_loopmgr,
|
isc_managers_create(&named_g_mctx, named_g_cpus, &named_g_loopmgr,
|
||||||
&named_g_netmgr);
|
&named_g_netmgr);
|
||||||
|
@@ -23,6 +23,10 @@ typedef int32_t isc_tid_t;
|
|||||||
|
|
||||||
#define ISC_TID_UNKNOWN (isc_tid_t) - 1
|
#define ISC_TID_UNKNOWN (isc_tid_t) - 1
|
||||||
|
|
||||||
|
#ifndef ISC_TID_MAX
|
||||||
|
#define ISC_TID_MAX 512
|
||||||
|
#endif /* ISC_TID_MAX */
|
||||||
|
|
||||||
isc_tid_t
|
isc_tid_t
|
||||||
isc_tid_count(void);
|
isc_tid_count(void);
|
||||||
/*%<
|
/*%<
|
||||||
|
@@ -37,12 +37,14 @@ static isc_tid_t tid_count = 0;
|
|||||||
void
|
void
|
||||||
isc__tid_init(isc_tid_t tid) {
|
isc__tid_init(isc_tid_t tid) {
|
||||||
REQUIRE(isc__tid_local == ISC_TID_UNKNOWN || isc__tid_local == tid);
|
REQUIRE(isc__tid_local == ISC_TID_UNKNOWN || isc__tid_local == tid);
|
||||||
|
REQUIRE(tid < ISC_TID_MAX);
|
||||||
isc__tid_local = tid;
|
isc__tid_local = tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
isc__tid_initcount(isc_tid_t count) {
|
isc__tid_initcount(isc_tid_t count) {
|
||||||
REQUIRE(tid_count == 0 || tid_count == count);
|
REQUIRE(tid_count == 0 || tid_count == count);
|
||||||
|
REQUIRE(tid_count < ISC_TID_MAX);
|
||||||
tid_count = count;
|
tid_count = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user