]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Tune min and max chunk size
authorAlessio Podda <alessio@isc.org>
Mon, 5 May 2025 09:43:44 +0000 (11:43 +0200)
committerEvan Hunt <each@isc.org>
Thu, 22 May 2025 22:19:48 +0000 (15:19 -0700)
Before implementing adaptive chunk sizing, it was necessary to ensure
that a chunk could hold up to 48 twigs, but the new logic will size-up
new chunks to ensure that the current allocation can succeed.

We exploit the new logic in two ways:
 - We make the minimum chunk size smaller than the old limit of 2^6,
   reducing memory consumption.
 - We make the maximum chunk size larger, as it has been observed that
   it improves resolver performance.

lib/dns/qp_p.h

index add3bdeaeebec9f85dbb726069560ef30a37a0a2..efe5c5d9b008dc51e55dea3b7bb1c19d1d2509d5 100644 (file)
@@ -143,14 +143,14 @@ enum {
  * size to make the allocator work harder.
  */
 #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
-#define QP_CHUNK_LOG_MIN 6
+#define QP_CHUNK_LOG_MIN 7
 #define QP_CHUNK_LOG_MAX 7
 #else
-#define QP_CHUNK_LOG_MIN 6
-#define QP_CHUNK_LOG_MAX 10
+#define QP_CHUNK_LOG_MIN 3
+#define QP_CHUNK_LOG_MAX 12
 #endif
 
-STATIC_ASSERT(6 <= QP_CHUNK_LOG_MIN && QP_CHUNK_LOG_MIN <= QP_CHUNK_LOG_MAX,
+STATIC_ASSERT(2 <= QP_CHUNK_LOG_MIN && QP_CHUNK_LOG_MIN <= QP_CHUNK_LOG_MAX,
              "qp-trie min chunk size is unreasonable");
 STATIC_ASSERT(6 <= QP_CHUNK_LOG_MAX && QP_CHUNK_LOG_MAX <= 20,
              "qp-trie max chunk size is unreasonable");