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