2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Reduce the number of hazard pointers

Previously, we set the number of the hazard pointers to be 4 times the
number of workers because the dispatch ran on the old socket code.
Since the old socket code was removed there's a smaller number of
threads, namely:

 - 1 main thread
 - 1 timer thread
 - <n> netmgr threads
 - <n> threadpool threads

Set the number of hazard pointers to 2 + 2 * workers.
This commit is contained in:
Ondřej Surý
2021-12-07 20:35:58 +01:00
parent 15ce1737fa
commit c6f3e12fe7
2 changed files with 9 additions and 3 deletions

View File

@@ -27,10 +27,13 @@ isc_managers_create(isc_mem_t *mctx, size_t workers, size_t quantum,
isc_timermgr_t *timermgr = NULL;
/*
* We have ncpus network threads, ncpus old network threads - make
* it 4x just to be on the safe side.
* Currently, there are:
* - 1 main thread
* - 1 timer thread
* - n netmgr threads
* - n threadpool threads
*/
isc_hp_init(4 * workers);
isc_hp_init(2 + 2 * workers);
REQUIRE(netmgrp != NULL && *netmgrp == NULL);
isc__netmgr_create(mctx, workers, &netmgr);

View File

@@ -27,6 +27,7 @@
#include <isc/atomic.h>
#include <isc/buffer.h>
#include <isc/condition.h>
#include <isc/hp.h>
#include <isc/mutex.h>
#include <isc/netmgr.h>
#include <isc/nonce.h>
@@ -256,6 +257,8 @@ _setup(void **state) {
return (-1);
}
isc_hp_init(4 * workers);
signal(SIGPIPE, SIG_IGN);
return (0);