Behavior of madvise(MADV_FREE)

Jason Evans jasone at freebsd.org
Fri Oct 12 22:15:06 UTC 2012


On Oct 12, 2012, at 1:54 PM, Marcel Moolenaar wrote:
> BTW: MADV_DONTNEED in Linux seems to behave like MADV_FREE
> in FreeBSD -- at least according to the manpage. Which makes
> me wonder how standard madvise(2) is anyway.

MADV_DONTNEED on Linux immediately dissociates the physical page from the VM mapping, such that subsequent access results in a zero-filled page being soft-faulted into place.

MADV_FREE is *way* nicer than MADV_DONTNEED in the context of malloc.  jemalloc has a really discouraging amount of complexity that is directly a result of working around the performance overhead of MADV_DONTNEED.

Jason


More information about the freebsd-arch mailing list