Behavior of madvise(MADV_FREE)

Marcel Moolenaar marcel at xcllnt.net
Fri Oct 12 20:54:27 UTC 2012


On Oct 12, 2012, at 10:13 AM, Poul-Henning Kamp <phk at phk.freebsd.dk> wrote:

>> Now on to the questions:
>> 1.  madvise(MADV_FREE) marks the pages as clean and moves
>>   them to the inactive queue. 

> The mapping were left alone, because it was estimated and measured
> that there were a high frequency of mapping reuse, in particular
> in the WorldStone where multiple passes of GCC competed for physical
> memory.  The reference bit were left alone to not disturb the
> perceived/ measured VM-footprint of the process.

Good info. Thanks.

> Given that paging anonymous pages to disk is not a major activity
> and unlikely to ever become a performance bottleneck again, it may
> make good sense to let MADV_FREE make the pages more appetizing
> for the rest of the system.
> 
> But all things considered, I would advocate implementing MADV_RECYCLE
> for that, we need more nuance and expressability in madvice(2) and
> MADV_RECYCLE would be a good addition in its own right.

Ok. I think Linux has MADV_REMOVE that roughly matches the
semantics, so it's not "non-standard" to add more behaviours.

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.

-- 
Marcel Moolenaar
marcel at xcllnt.net




More information about the freebsd-arch mailing list