]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Reduce freemax values for dns_message mempools
authorOndřej Surý <ondrej@sury.org>
Wed, 15 Dec 2021 16:48:28 +0000 (17:48 +0100)
committerOndřej Surý <ondrej@sury.org>
Wed, 15 Dec 2021 20:25:00 +0000 (21:25 +0100)
It was discovered that NAME_FREEMAX and RDATASET_FREEMAX was based on
the NAME_FILLCOUNT and RDATASET_FILLCOUNT respectively multiplied by 8
and then when used in isc_mempool_setfreemax, the value would be again
multiplied by 32.

Keep the 8 multiplier in the #define and remove the 32 multiplier as it
was kept in error.  The default fillcount can fit 99.99% of the requests
under normal circumstances, so we don't need to keep that many free
items on the mempool.

lib/dns/message.c

index afc1441948a84c5ce77a44dd2ae6b530dacdad9e..4d437dd3e63b60e22d196977f8c823cf691dd489 100644 (file)
@@ -722,12 +722,12 @@ dns_message_create(isc_mem_t *mctx, unsigned int intent, dns_message_t **msgp) {
 
        isc_mempool_create(m->mctx, sizeof(dns_fixedname_t), &m->namepool);
        isc_mempool_setfillcount(m->namepool, NAME_FILLCOUNT);
-       isc_mempool_setfreemax(m->namepool, 32 * NAME_FREEMAX);
+       isc_mempool_setfreemax(m->namepool, NAME_FREEMAX);
        isc_mempool_setname(m->namepool, "msg:names");
 
        isc_mempool_create(m->mctx, sizeof(dns_rdataset_t), &m->rdspool);
        isc_mempool_setfillcount(m->rdspool, RDATASET_FILLCOUNT);
-       isc_mempool_setfreemax(m->rdspool, 32 * RDATASET_FREEMAX);
+       isc_mempool_setfreemax(m->rdspool, RDATASET_FREEMAX);
        isc_mempool_setname(m->rdspool, "msg:rdataset");
 
        isc_buffer_allocate(mctx, &dynbuf, SCRATCHPAD_SIZE);