aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2017-10-05 16:28:55 -0700
committerQi Wang <interwq@gmail.com>2017-10-11 15:49:22 -0700
commit31ab38be5f3c4b826db89ff3cd4f32f988747f06 (patch)
tree03f81b199f119c8934e259095f471f79f95923c2 /include
parentfc83de0384a2ad87cf5059d4345acf014c77e6e4 (diff)
downloadplatform_external_jemalloc_new-31ab38be5f3c4b826db89ff3cd4f32f988747f06.tar.gz
platform_external_jemalloc_new-31ab38be5f3c4b826db89ff3cd4f32f988747f06.tar.bz2
platform_external_jemalloc_new-31ab38be5f3c4b826db89ff3cd4f32f988747f06.zip
Define MADV_FREE on our own when needed.
On x86 Linux, we define our own MADV_FREE if madvise(2) is available, but no MADV_FREE is detected. This allows the feature to be built in and enabled with runtime detection.
Diffstat (limited to 'include')
-rw-r--r--include/jemalloc/internal/jemalloc_internal_defs.h.in3
-rw-r--r--include/jemalloc/internal/jemalloc_preamble.h.in4
2 files changed, 7 insertions, 0 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in
index 31262fb2..b56f21f8 100644
--- a/include/jemalloc/internal/jemalloc_internal_defs.h.in
+++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in
@@ -285,6 +285,9 @@
#undef JEMALLOC_PURGE_MADVISE_DONTNEED
#undef JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS
+/* Defined if madvise(2) is available but MADV_FREE is not (x86 Linux only). */
+#undef JEMALLOC_DEFINE_MADVISE_FREE
+
/*
* Defined if transparent huge pages (THPs) are supported via the
* MADV_[NO]HUGEPAGE arguments to madvise(2), and THP support is enabled.
diff --git a/include/jemalloc/internal/jemalloc_preamble.h.in b/include/jemalloc/internal/jemalloc_preamble.h.in
index f6ed731c..f81f3a40 100644
--- a/include/jemalloc/internal/jemalloc_preamble.h.in
+++ b/include/jemalloc/internal/jemalloc_preamble.h.in
@@ -47,6 +47,10 @@
#endif
#include "jemalloc/internal/hooks.h"
+#ifdef JEMALLOC_DEFINE_MADVISE_FREE
+# define JEMALLOC_MADV_FREE 8
+#endif
+
static const bool config_debug =
#ifdef JEMALLOC_DEBUG
true