]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Don't create per bucket memory contexts in resolver
authorOndřej Surý <ondrej@sury.org>
Tue, 11 May 2021 10:09:15 +0000 (12:09 +0200)
committerOndřej Surý <ondrej@sury.org>
Mon, 24 May 2021 18:02:20 +0000 (20:02 +0200)
Similarly, the resolver code would create hundreds of memory contexts
just on the resolver setup.  The contention will be reduced directly in
the allocator, so for now just attach to the view memory instead of
creating separate memory context for each bucket.

lib/dns/resolver.c

index 9840016f9ea94f83d926d8c37b59fdff6d8b8223..53b76e9974fb057d81de4ccafc27df912e882d69 100644 (file)
@@ -10402,12 +10402,7 @@ dns_resolver_create(dns_view_t *view, isc_taskmgr_t *taskmgr,
                }
                res->buckets[i].mctx = NULL;
                snprintf(name, sizeof(name), "res%u", i);
-               /*
-                * Use a separate memory context for each bucket to reduce
-                * contention among multiple threads.  Do this only when
-                * enabling threads because it will be require more memory.
-                */
-               isc_mem_create(&res->buckets[i].mctx);
+               isc_mem_attach(view->mctx, &res->buckets[i].mctx);
                isc_mem_setname(res->buckets[i].mctx, name);
                isc_task_setname(res->buckets[i].task, name, res);
                ISC_LIST_INIT(res->buckets[i].fctxs);