Page MenuHomeFreeBSD

MADV_FREE: Quick fix to time rewind
ClosedPublic

Authored by nwf20_cl.cam.ac.uk on Sep 4 2019, 1:35 PM.
Tags
None
Referenced Files
F81519073: D21517.id.diff
Wed, Apr 17, 11:19 AM
Unknown Object (File)
Tue, Apr 9, 6:32 AM
Unknown Object (File)
Mar 4 2024, 1:19 PM
Unknown Object (File)
Feb 18 2024, 7:14 AM
Unknown Object (File)
Feb 16 2024, 8:23 AM
Unknown Object (File)
Jan 13 2024, 8:17 PM
Unknown Object (File)
Dec 31 2023, 5:41 AM
Unknown Object (File)
Dec 22 2023, 4:25 AM

Details

Summary

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.

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240061

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib added inline comments.
sys/vm/vm_map.c
2786 ↗(On Diff #61642)

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.