From ce93055c49a5cd0f32792bbaeeaa0fb4b788f1ee Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Sun, 24 Oct 2010 13:03:07 -0700 Subject: Use madvise(..., MADV_FREE) on OS X. Use madvise(..., MADV_FREE) rather than msync(..., MS_KILLPAGES) on OS X, since it works for at least OS X 10.5 and 10.6. --- jemalloc/configure.ac | 2 +- jemalloc/include/jemalloc/jemalloc_defs.h.in | 9 +++------ jemalloc/src/arena.c | 3 --- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/jemalloc/configure.ac b/jemalloc/configure.ac index b613cb1..0ed1373 100644 --- a/jemalloc/configure.ac +++ b/jemalloc/configure.ac @@ -166,7 +166,7 @@ case "${host}" in *-*-darwin*) CFLAGS="$CFLAGS -fno-common -no-cpp-precomp" abi="macho" - AC_DEFINE([JEMALLOC_PURGE_MSYNC_KILLPAGES]) + AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE]) RPATH="" ;; *-*-freebsd*) diff --git a/jemalloc/include/jemalloc/jemalloc_defs.h.in b/jemalloc/include/jemalloc/jemalloc_defs.h.in index 54e5d94..b8f3f36 100644 --- a/jemalloc/include/jemalloc/jemalloc_defs.h.in +++ b/jemalloc/include/jemalloc/jemalloc_defs.h.in @@ -121,15 +121,12 @@ * 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, this marks pages as being unused, - * such that they will be discarded rather than - * swapped out. - * msync(..., MS_KILLPAGES) : On Darwin, this behaves similarly to - * madvise(..., MADV_FREE) on FreeBSD. + * madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being + * unused, such that they will be discarded rather + * than swapped out. */ #undef JEMALLOC_PURGE_MADVISE_DONTNEED #undef JEMALLOC_PURGE_MADVISE_FREE -#undef JEMALLOC_PURGE_MSYNC_KILLPAGES /* sizeof(void *) == 2^LG_SIZEOF_PTR. */ #undef LG_SIZEOF_PTR diff --git a/jemalloc/src/arena.c b/jemalloc/src/arena.c index 00f425f..3d4f888 100644 --- a/jemalloc/src/arena.c +++ b/jemalloc/src/arena.c @@ -800,9 +800,6 @@ arena_chunk_purge(arena_t *arena, arena_chunk_t *chunk) #elif defined(JEMALLOC_PURGE_MADVISE_FREE) madvise((void *)((uintptr_t)chunk + (pageind << PAGE_SHIFT)), (npages << PAGE_SHIFT), MADV_FREE); -#elif defined(JEMALLOC_PURGE_MSYNC_KILLPAGES) - msync((void *)((uintptr_t)chunk + (pageind << PAGE_SHIFT)), - (npages << PAGE_SHIFT), MS_KILLPAGES); #else # error "No method defined for purging unused dirty pages." #endif -- cgit v0.12