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