Page MenuHomeFreeBSD

MADV_FREE: Quick fix to time rewind

Authored by on Sep 4 2019, 1:35 PM.



Don't FREE pages in a shadowing object. While this degrades MADV_FREE to a no-op (and we could, instead, choose to fall back to MADV_DONTNEED, at the cost of changing pmap_madvise), this is presently considered a temporary fix. We may prefer to risk a little fragmentation of the map by creating a zero/OBJT_DEFAULT entry over top of the existing object and, simultaneously, revert to the existing marking any pages in the former shadowing object in the advised region as reclaimable. At least one consumer of MADV_FREE (snmalloc) may use mmap() to construct zeroed pages "eventually" here anyway, so the fragmentation may be coming anyway.


Diff Detail

Lint Skipped
Unit Tests Skipped

Event Timeline

kib added inline comments.

I suggest to leave only the first sentence in the comment. You can write more in the commit message (AKA the review summary).

On the other hand, it might be worth noting that (even) read-only map lock prevents both object.vm_object and its backing_object from changing under us, so the test is valid after being performed.

I think this is fine modulo kib's comment. As I noted in the PR we could downgrade to MADV_DONTNEED instead, but that requires a change to pmap_advise().

This revision is now accepted and ready to land.Sep 4 2019, 5:03 PM
This revision was automatically updated to reflect the committed changes.