Support AutoConf for posix_madvise and POSIX_MADV_DONTNEED

This commit is contained in:
Jin Qian 2020-10-30 13:54:36 -07:00 committed by David Goldblatt
parent 96a59c3bb5
commit 26c1dc5a3a
2 changed files with 31 additions and 0 deletions

View File

@ -2204,6 +2204,26 @@ case "${host_cpu}" in
fi fi
;; ;;
esac esac
else
dnl Check for posix_madvise.
JE_COMPILABLE([posix_madvise], [
#include <sys/mman.h>
], [
posix_madvise((void *)0, 0, 0);
], [je_cv_posix_madvise])
if test "x${je_cv_posix_madvise}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_POSIX_MADVISE], [ ])
dnl Check for posix_madvise(..., POSIX_MADV_DONTNEED).
JE_COMPILABLE([posix_madvise(..., POSIX_MADV_DONTNEED)], [
#include <sys/mman.h>
], [
posix_madvise((void *)0, 0, POSIX_MADV_DONTNEED);
], [je_cv_posix_madv_dontneed])
if test "x${je_cv_posix_madv_dontneed}" = "xyes" ; then
AC_DEFINE([JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED], [ ])
fi
fi
fi fi
dnl ============================================================================ dnl ============================================================================

View File

@ -318,6 +318,17 @@
*/ */
#undef JEMALLOC_THP #undef JEMALLOC_THP
/* Defined if posix_madvise is available. */
#undef JEMALLOC_HAVE_POSIX_MADVISE
/*
* Method for purging unused pages using posix_madvise.
*
* posix_madvise(..., POSIX_MADV_DONTNEED)
*/
#undef JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED
#undef JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED_ZEROS
/* /*
* Defined if memcntl page admin call is supported * Defined if memcntl page admin call is supported
*/ */