99b754
From 6d6acf236841da5c2511f8afcd3e4a89af4c5658 Mon Sep 17 00:00:00 2001
99b754
From: =?UTF-8?q?Witold=20Kr=C4=99cicki?= <wpk@isc.org>
99b754
Date: Fri, 14 Feb 2020 09:18:48 +0100
99b754
Subject: [PATCH] Use RESOLVER_NTASKS_PERCPU - 32 for regular tuning, 8 for
99b754
 small
99b754
99b754
Modify original upstream commit 0d80266f7e3, add high limit of used
99b754
tasks. Minimum would be lower on machines with few cpus, but maximum
99b754
would stay unchanged. Should prevent negatives of this change.
99b754
99b754
Signed-off-by: Petr Mensik <pemensik@redhat.com>
99b754
---
99b754
 bin/named/server.c | 12 ++++++++----
99b754
 1 file changed, 8 insertions(+), 4 deletions(-)
99b754
99b754
diff --git a/bin/named/server.c b/bin/named/server.c
99b754
index 39b1124..94b4daa 100644
99b754
--- a/bin/named/server.c
99b754
+++ b/bin/named/server.c
99b754
@@ -148,11 +148,13 @@
99b754
 #endif
99b754
 
99b754
 #ifdef TUNE_LARGE
99b754
-#define RESOLVER_NTASKS 523
99b754
+#define RESOLVER_NTASKS_MAX 523
99b754
+#define RESOLVER_NTASKS_PERCPU 32
99b754
 #define UDPBUFFERS 32768
99b754
 #define EXCLBUFFERS 32768
99b754
 #else
99b754
-#define RESOLVER_NTASKS 31
99b754
+#define RESOLVER_NTASKS_MAX 31
99b754
+#define RESOLVER_NTASKS_PERCPU 8
99b754
 #define UDPBUFFERS 1000
99b754
 #define EXCLBUFFERS 4096
99b754
 #endif /* TUNE_LARGE */
99b754
@@ -3318,7 +3320,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
99b754
 	ns_cache_t *nsc;
99b754
 	bool zero_no_soattl;
99b754
 	dns_acl_t *clients = NULL, *mapped = NULL, *excluded = NULL;
99b754
-	unsigned int query_timeout, ndisp;
99b754
+	unsigned int query_timeout, ndisp, ntasks;
99b754
 	bool old_rpz_ok = false;
99b754
 	isc_dscp_t dscp4 = -1, dscp6 = -1;
99b754
 	dns_dyndbctx_t *dctx = NULL;
99b754
@@ -3926,7 +3928,9 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
99b754
 	dns_view_setresquerystats(view, resquerystats);
99b754
 
99b754
 	ndisp = 4 * ISC_MIN(ns_g_udpdisp, MAX_UDP_DISPATCH);
99b754
-	CHECK(dns_view_createresolver(view, ns_g_taskmgr, RESOLVER_NTASKS,
99b754
+	ntasks = ISC_MIN(RESOLVER_NTASKS_PERCPU * ns_g_cpus,
99b754
+		         RESOLVER_NTASKS_MAX);
99b754
+	CHECK(dns_view_createresolver(view, ns_g_taskmgr, ntasks,
99b754
 				      ndisp, ns_g_socketmgr, ns_g_timermgr,
99b754
 				      resopts, ns_g_dispatchmgr,
99b754
 				      dispatch4, dispatch6));
99b754
-- 
99b754
2.34.1
99b754