Add configure-time detection for madvise(..., MADV_DO[NT]DUMP)

This commit is contained in:
David Goldblatt 2017-09-18 15:03:52 -07:00 committed by David Goldblatt
parent 211b1f3c7d
commit ccd09050aa
2 changed files with 16 additions and 0 deletions

View File

@ -1845,6 +1845,17 @@ if test "x${je_cv_madvise}" = "xyes" ; then
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ]) AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
fi fi
dnl Check for madvise(..., MADV_DO[NT]DUMP).
JE_COMPILABLE([madvise(..., MADV_DO[[NT]]DUMP)], [
#include <sys/mman.h>
], [
madvise((void *)0, 0, MADV_DONTDUMP);
madvise((void *)0, 0, MADV_DODUMP);
], [je_cv_madv_dontdump])
if test "x${je_cv_madv_dontdump}" = "xyes" ; then
AC_DEFINE([JEMALLOC_MADVISE_DONTDUMP], [ ])
fi
dnl Check for madvise(..., MADV_[NO]HUGEPAGE). dnl Check for madvise(..., MADV_[NO]HUGEPAGE).
JE_COMPILABLE([madvise(..., MADV_[[NO]]HUGEPAGE)], [ JE_COMPILABLE([madvise(..., MADV_[[NO]]HUGEPAGE)], [
#include <sys/mman.h> #include <sys/mman.h>

View File

@ -288,6 +288,11 @@
/* Defined if madvise(2) is available but MADV_FREE is not (x86 Linux only). */ /* Defined if madvise(2) is available but MADV_FREE is not (x86 Linux only). */
#undef JEMALLOC_DEFINE_MADVISE_FREE #undef JEMALLOC_DEFINE_MADVISE_FREE
/*
* Defined if MADV_DO[NT]DUMP is supported as an argument to madvise.
*/
#undef JEMALLOC_MADVISE_DONTDUMP
/* /*
* Defined if transparent huge pages (THPs) are supported via the * Defined if transparent huge pages (THPs) are supported via the
* MADV_[NO]HUGEPAGE arguments to madvise(2), and THP support is enabled. * MADV_[NO]HUGEPAGE arguments to madvise(2), and THP support is enabled.