bind9/lib/isc
alessio d21f63884a Adaptive memory allocation strategy for qp-tries
qp-tries allocate their nodes (twigs) in chunks to reduce allocator
pressure and improve memory locality. The choice of chunk size presents
a tradeoff: larger chunks benefit qp-tries with many values (as seen
in large zones and resolvers) but waste memory in smaller use cases.

Previously, our fixed chunk size of 2^10 twigs meant that even an
empty qp-trie would consume 12KB of memory, while reducing this size
would negatively impact resolver performance.

This commit implements an adaptive chunking strategy that:
 - Tracks the size of the most recently allocated chunk.
 - Doubles the chunk size for each new allocation until reaching a
   predefined maximum.

This approach effectively balances memory efficiency for small tries
while maintaining the performance benefits of larger chunk sizes for
bigger data structures.

This commit also splits the callback freeing qpmultis into two
phases, one that frees the underlying qptree, and one that reclaims
the qpmulti memory. In order to prevent races between the qpmulti
destructor and chunk garbage collection jobs, the second phase is
protected by reference counting.

(cherry picked from commit 70b1777d8a)
2025-08-05 12:48:19 +02:00
..
include Adaptive memory allocation strategy for qp-tries 2025-08-05 12:48:19 +02:00
netmgr Use clang-format-20 to update formatting 2025-06-25 13:32:08 +10:00
.gitignore Add support for User Statically Defined Tracing (USDT) probes 2023-08-21 18:39:53 +02:00
ascii.c Consolidate some ASCII tables in isc/ascii and isc/hex 2022-09-12 12:18:57 +01:00
assertions.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
async.c Cleanup the __tsan_acquire/__tsan_release 2023-07-28 08:59:08 +02:00
async_p.h Change the isc_async API to use cds_wfcqueue internally 2023-05-12 14:16:25 +02:00
backtrace.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
base32.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
base64.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
commandline.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
condition.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
counter.c Implement global limit for outgoing queries 2024-12-06 06:20:33 +00:00
crc64.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
dir.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
entropy.c Switch the CSPRNG function from RAND_bytes() to uv_random() 2022-09-26 15:13:11 +02:00
errno.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
errno2result.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
errno2result.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
error.c Remove do-nothing header <isc/print.h> 2023-02-15 16:44:47 +00:00
file.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
fips.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
getaddresses.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
hash.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
hashmap.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
heap.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
helper.c Add isc_helper API that adds 1:1 thread for each loop 2024-09-12 14:39:07 +00:00
hex.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
histo.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
hmac.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
ht.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
httpd.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
interfaceiter.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
iterated_hash.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
jemalloc_shim.h Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
job.c Add tracing probes to the isc_job unit 2023-08-21 18:39:53 +02:00
job_p.h Use proper padding instead of using alignas() 2024-02-08 10:54:35 +01:00
lex.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
lib.c Implement incremental version of isc_hash32 and isc_hash64 2023-09-12 16:17:06 +02:00
log.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
loop.c mark loop as shuttingdown earlier in shutdown_cb 2024-12-10 19:52:13 +00:00
loop_p.h Add isc_helper API that adds 1:1 thread for each loop 2024-09-12 14:39:07 +00:00
Makefile.am Add isc_helper API that adds 1:1 thread for each loop 2024-09-12 14:39:07 +00:00
managers.c Set name for all the isc_mem context 2025-05-29 05:45:12 +02:00
md.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
mem.c Adaptive memory allocation strategy for qp-tries 2025-08-05 12:48:19 +02:00
mem_p.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
meminfo.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
mutex.c Fix PTHREAD_MUTEX_ADAPTIVE_NP and PTHREAD_MUTEX_ERRORCHECK_NP usage 2024-08-05 09:13:07 +00:00
mutex_p.h Use library constructor to create default mutex attr once 2022-07-13 13:19:32 +02:00
mutexblock.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
net.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
netaddr.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
netscope.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
nonce.c Switch the CSPRNG function from RAND_bytes() to uv_random() 2022-09-26 15:13:11 +02:00
openssl_shim.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
openssl_shim.h Remove unused <openssl/{hmac,engine}.h> headers from OpenSSL shims 2024-10-16 04:39:43 +00:00
os.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
os_p.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
parseint.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
picohttpparser.c Update picohttpparser.{c,h} with upstream repository 2024-12-08 12:30:07 +00:00
picohttpparser.h Update picohttpparser.{c,h} with upstream repository 2024-12-08 12:30:07 +00:00
portset.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
probes.d Add tracing probes to the isc_job unit 2023-08-21 18:39:53 +02:00
proxy2.c Use clang-format-20 to update formatting 2025-06-25 13:32:08 +10:00
quota.c Fix isc_quota bug 2025-02-20 12:20:25 +00:00
radix.c Use clang-format-20 to update formatting 2025-06-25 13:32:08 +10:00
random.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
ratelimiter.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
regex.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
region.c Incrementally apply AXFR transfer 2024-11-26 07:17:06 +00:00
result.c Use clang-format-20 to update formatting 2025-06-25 13:32:08 +10:00
rwlock.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
safe.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
serial.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
signal.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
sockaddr.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
stats.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
stdio.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
stdtime.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
string.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
symtab.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
syslog.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
tests Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
thread.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
tid.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
time.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
timer.c Add isc_timer_running() function to check status of timer 2025-02-21 22:27:25 +01:00
tls.c Add isc_tls_valid_sni_hostname() 2025-03-31 15:06:59 +03:00
tm.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
url.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
utf8.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
uv.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
work.c Call isc__iterated_hash_initialize 2025-03-04 13:49:38 +00:00
xml.c Disable own memory context for libxml2 on macOS 15.4 Sequoia 2025-04-18 21:00:52 +02:00