diff options
author | Jason Evans <jasone@canonware.com> | 2017-03-10 02:20:02 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2017-03-14 01:19:57 (GMT) |
commit | 7cbcd2e2b70d9a8547030b5a8640c85b2b7b50ab (patch) | |
tree | 9e8065b9556d53cec06633119a5db2ed6cc54059 /include | |
parent | 21a68e2d22da08e0f60ff79d6866dd3add19775b (diff) | |
download | jemalloc-7cbcd2e2b70d9a8547030b5a8640c85b2b7b50ab.zip jemalloc-7cbcd2e2b70d9a8547030b5a8640c85b2b7b50ab.tar.gz jemalloc-7cbcd2e2b70d9a8547030b5a8640c85b2b7b50ab.tar.bz2 |
Fix pages_purge_forced() to discard pages on non-Linux systems.
madvise(..., MADV_DONTNEED) only causes demand-zeroing on Linux, so fall
back to overlaying a new mapping.
Diffstat (limited to 'include')
-rw-r--r-- | include/jemalloc/internal/jemalloc_internal_defs.h.in | 11 | ||||
-rw-r--r-- | include/jemalloc/internal/pages_types.h | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in index 500f427..28eb0b3 100644 --- a/include/jemalloc/internal/jemalloc_internal_defs.h.in +++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in @@ -265,12 +265,17 @@ * * 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. + * madvise(..., MADV_DONTNEED) : If JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS is + * defined, this immediately discards pages, + * such that new pages will be demand-zeroed if + * the address region is later touched; + * otherwise this behaves similarly to + * MADV_FREE, though typically with higher + * system overhead. */ #undef JEMALLOC_PURGE_MADVISE_FREE #undef JEMALLOC_PURGE_MADVISE_DONTNEED +#undef JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS /* * Defined if transparent huge pages are supported via the MADV_[NO]HUGEPAGE diff --git a/include/jemalloc/internal/pages_types.h b/include/jemalloc/internal/pages_types.h index 9e6e7c5..e44ee2a 100644 --- a/include/jemalloc/internal/pages_types.h +++ b/include/jemalloc/internal/pages_types.h @@ -37,7 +37,9 @@ * next step after purging on Windows anyway, there's no point in adding such * complexity. */ -#if !defined(_WIN32) && defined(JEMALLOC_PURGE_MADVISE_DONTNEED) +#if !defined(_WIN32) && ((defined(JEMALLOC_PURGE_MADVISE_DONTNEED) && \ + defined(JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS)) || \ + defined(JEMALLOC_MAPS_COALESCE)) # define PAGES_CAN_PURGE_FORCED #endif |