From c6f3e12fe74bc24285db27c75bfce421d9751954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 7 Dec 2021 20:35:58 +0100 Subject: [PATCH] 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 - netmgr threads - threadpool threads Set the number of hazard pointers to 2 + 2 * workers. --- lib/isc/managers.c | 9 ++++++--- lib/isc/tests/doh_test.c | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/isc/managers.c b/lib/isc/managers.c index 094e4c0eb8..b57f8ab7c6 100644 --- a/lib/isc/managers.c +++ b/lib/isc/managers.c @@ -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); diff --git a/lib/isc/tests/doh_test.c b/lib/isc/tests/doh_test.c index 117728554d..7a2c06571b 100644 --- a/lib/isc/tests/doh_test.c +++ b/lib/isc/tests/doh_test.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -256,6 +257,8 @@ _setup(void **state) { return (-1); } + isc_hp_init(4 * workers); + signal(SIGPIPE, SIG_IGN); return (0);