From 8f4e2075a703acce08056321f49defd44dae19ed Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 24 May 2018 17:16:12 +0200 Subject: Update documentation about how to upgrade Jemalloc. --- deps/README.md | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'deps/README.md') diff --git a/deps/README.md b/deps/README.md index 0ce480046..69b3585cf 100644 --- a/deps/README.md +++ b/deps/README.md @@ -13,13 +13,30 @@ How to upgrade the above dependencies Jemalloc --- -Jemalloc is unmodified. We only change settings via the `configure` script of Jemalloc using the `--with-lg-quantum` option, setting it to the value of 3 instead of 4. This provides us with more size classes that better suit the Redis data structures, in order to gain memory efficiency. - -So in order to upgrade jemalloc: +Jemalloc is modified with changes that allow us to implement the Redis +active defragmentation logic. However this feature of Redis is not mandatory +and Redis is able to understand if the Jemalloc version it is compiled +against supports such Redis-specific modifications. So in theory, if you +are not interested in the active defragmentation, you can replace Jemalloc +just following tose steps: 1. Remove the jemalloc directory. 2. Substitute it with the new jemalloc source tree. +However note that we change Jemalloc settings via the `configure` script of Jemalloc using the `--with-lg-quantum` option, setting it to the value of 3 instead of 4. This provides us with more size classes that better suit the Redis data structures, in order to gain memory efficiency. + +Instead if you want to upgrade Jemalloc while also providing support for +defragmentation, you have to replace it with a newer version, and make +the following changes: + +1. In Jemalloc three, file `include/jemalloc/jemalloc_macros.h.in`, make sure + to add `#define JEMALLOC_FRAG_HINT`. +2. Implement the function `je_get_defrag_hint()` inside `src/jemalloc.c`. You + can see how it is implemented in the current Jemalloc source tree shipped + with Redis, and rewrite it according to the new Jemalloc internals, if they + changed, otherwise you could just copy the old implementation if you are + upgrading just to a similar version of Jemalloc. + Geohash --- -- cgit v1.2.1