From: Ondřej Surý Date: Tue, 11 May 2021 10:09:15 +0000 (+0200) Subject: Don't create per bucket memory contexts in resolver X-Git-Tag: v9.17.14~30^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aad7856b8efc011ef0b7cb38c6b9076697e40712;p=thirdparty%2Fbind9.git Don't create per bucket memory contexts in resolver 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. --- diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 9840016f9ea..53b76e9974f 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -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);