From: Ondřej Surý Date: Tue, 11 May 2021 10:33:31 +0000 (+0200) Subject: Add recommended jemalloc configuration for our load X-Git-Tag: v9.17.17~40^2~23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5184384efdbd000134b412e108ff1c1e174333d0;p=thirdparty%2Fbind9.git Add recommended jemalloc configuration for our load There's global variable called `malloc_conf` that can be used to configure jemalloc behaviour at the program startup. We use following configuration: * xmalloc:true - abort-on-out-of-memory enabled. * background_thread:true - Enable internal background worker threads to handle purging asynchronously. * metadata_thp:auto - allow jemalloc to use transparent huge page (THP) for internal metadata initially, but may begin to do so when metadata usage reaches certain level. * dirty_decay_ms:30000 - Approximate time in milliseconds from the creation of a set of unused dirty pages until an equivalent set of unused dirty pages is purged and/or reused. * muzzy_decay_ms:30000 - Approximate time in milliseconds from the creation of a set of unused muzzy pages until an equivalent set of unused muzzy pages is purged and/or reused. More information about the specific meaning can be found in the jemalloc manpage or online at http://jemalloc.net/jemalloc.3.html --- diff --git a/lib/isc/mem.c b/lib/isc/mem.c index 6adfd9d6716..33738b4af4c 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -42,6 +42,8 @@ #include #endif /* HAVE_JSON_C */ +#include + #include "mem_p.h" #define MCTXLOCK(m) LOCK(&m->lock) @@ -442,6 +444,9 @@ default_memfree(void *ptr) { static void mem_initialize(void) { + malloc_conf = "xmalloc:true,background_thread:true,metadata_thp:auto," + "dirty_decay_ms:30000,muzzy_decay_ms:30000"; + isc_mutex_init(&contextslock); ISC_LIST_INIT(contexts); totallost = 0;