diff options
| author | Jason Evans <jasone@canonware.com> | 2016-11-17 18:24:51 (GMT) |
|---|---|---|
| committer | Jason Evans <jasone@canonware.com> | 2016-11-17 18:31:57 (GMT) |
| commit | a64123ce13545ef57a36285cc9d33978e59fc3da (patch) | |
| tree | 7ba28f07b1ffe9622f101f0c9d0d814f05f9bdcd /include/jemalloc | |
| parent | f7ca1c9bc321feffe056f5d154c287f63e324020 (diff) | |
| download | jemalloc-a64123ce13545ef57a36285cc9d33978e59fc3da.zip jemalloc-a64123ce13545ef57a36285cc9d33978e59fc3da.tar.gz jemalloc-a64123ce13545ef57a36285cc9d33978e59fc3da.tar.bz2 | |
Refactor madvise(2) configuration.
Add feature tests for the MADV_FREE and MADV_DONTNEED flags to
madvise(2), so that MADV_FREE is detected and used for Linux kernel
versions 4.5 and newer. Refactor pages_purge() so that on systems which
support both flags, MADV_FREE is preferred over MADV_DONTNEED.
This resolves #387.
Diffstat (limited to 'include/jemalloc')
| -rw-r--r-- | include/jemalloc/internal/jemalloc_internal_defs.h.in | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in index 4d2daea..baf12d4 100644 --- a/include/jemalloc/internal/jemalloc_internal_defs.h.in +++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in @@ -56,11 +56,6 @@ #undef JEMALLOC_HAVE_BUILTIN_CLZ /* - * Defined if madvise(2) is available. - */ -#undef JEMALLOC_HAVE_MADVISE - -/* * Defined if os_unfair_lock_*() functions are available, as provided by Darwin. */ #undef JEMALLOC_OS_UNFAIR_LOCK @@ -249,18 +244,20 @@ #undef JEMALLOC_SYSCTL_VM_OVERCOMMIT #undef JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY +/* Defined if madvise(2) is available. */ +#undef JEMALLOC_HAVE_MADVISE + /* * Methods for purging unused pages differ between operating systems. * - * madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages, - * such that new pages will be demand-zeroed if - * the address region is later touched. - * madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being - * unused, such that they will be discarded rather - * than swapped out. + * madvise(..., MADV_FREE) : This marks pages as being unused, such that they + * will be discarded rather than swapped out. + * madvise(..., MADV_DONTNEED) : This immediately discards pages, such that + * new pages will be demand-zeroed if the + * address region is later touched. */ -#undef JEMALLOC_PURGE_MADVISE_DONTNEED #undef JEMALLOC_PURGE_MADVISE_FREE +#undef JEMALLOC_PURGE_MADVISE_DONTNEED /* Define if operating system has alloca.h header. */ #undef JEMALLOC_HAS_ALLOCA_H |
