aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2017-11-09 13:51:39 -0800
committerQi Wang <interwq@gmail.com>2017-11-16 15:32:02 -0800
commitfac706836ffda46759914508b918e8b54c8020c8 (patch)
treedd99c6e68c7d34559d7f90a433aec0529b22e6f9 /include
parent282a3faa1784783e2e2cb3698183927b3927b950 (diff)
downloadplatform_external_jemalloc_new-fac706836ffda46759914508b918e8b54c8020c8.tar.gz
platform_external_jemalloc_new-fac706836ffda46759914508b918e8b54c8020c8.tar.bz2
platform_external_jemalloc_new-fac706836ffda46759914508b918e8b54c8020c8.zip
Add opt.lg_extent_max_active_fit
When allocating from dirty extents (which we always prefer if available), large active extents can get split even if the new allocation is much smaller, in which case the introduced fragmentation causes high long term damage. This new option controls the threshold to reuse and split an existing active extent. We avoid using a large extent for much smaller sizes, in order to reduce fragmentation. In some workload, adding the threshold improves virtual memory usage by >10x.
Diffstat (limited to 'include')
-rw-r--r--include/jemalloc/internal/extent_externs.h8
-rw-r--r--include/jemalloc/internal/extent_types.h6
2 files changed, 11 insertions, 3 deletions
diff --git a/include/jemalloc/internal/extent_externs.h b/include/jemalloc/internal/extent_externs.h
index 132d8903..a76d4e4a 100644
--- a/include/jemalloc/internal/extent_externs.h
+++ b/include/jemalloc/internal/extent_externs.h
@@ -6,9 +6,11 @@
#include "jemalloc/internal/ph.h"
#include "jemalloc/internal/rtree.h"
-extern rtree_t extents_rtree;
-extern const extent_hooks_t extent_hooks_default;
-extern mutex_pool_t extent_mutex_pool;
+extern size_t opt_lg_extent_max_active_fit;
+
+extern rtree_t extents_rtree;
+extern const extent_hooks_t extent_hooks_default;
+extern mutex_pool_t extent_mutex_pool;
extent_t *extent_alloc(tsdn_t *tsdn, arena_t *arena);
void extent_dalloc(tsdn_t *tsdn, arena_t *arena, extent_t *extent);
diff --git a/include/jemalloc/internal/extent_types.h b/include/jemalloc/internal/extent_types.h
index 7efcd3a4..c0561d99 100644
--- a/include/jemalloc/internal/extent_types.h
+++ b/include/jemalloc/internal/extent_types.h
@@ -8,4 +8,10 @@ typedef struct extents_s extents_t;
#define EXTENT_GROW_MAX_PIND (NPSIZES - 1)
+/*
+ * When reuse (and split) an active extent, (1U << opt_lg_extent_max_active_fit)
+ * is the max ratio between the size of the active extent and the new extent.
+ */
+#define LG_EXTENT_MAX_ACTIVE_FIT_DEFAULT 6
+
#endif /* JEMALLOC_INTERNAL_EXTENT_TYPES_H */