HomeFreeBSD

Implement an approximation of Linux MADV_DONTNEED semantics.

Description

Implement an approximation of Linux MADV_DONTNEED semantics.

Linux MADV_DONTNEED is not advisory: it has side effects for anonymous
memory, and some system software depends on that. In particular,
MADV_DONTNEED causes anonymous pages to be discarded. If the mapping is
a private mapping of a named object then subsequent faults are to
repopulate the range from that object, otherwise pages will be
zero-filled. For mappings of non-anonymous objects, Linux MADV_DONTNEED
can be implemented in the same way as our MADV_DONTNEED.

This implementation differs from Linux semantics in its handling of
private mappings, inherited through fork(), of non-anonymous objects.
After applying MADV_DONTNEED, subsequent faults will repopulate the
mapping from the parent object rather than the root of the shadow chain.

PR: 230160
Reviewed by: alc, kib
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25330

Details

Provenance
markjAuthored on
Reviewer
alc
Differential Revision
D25330: Partially implement Linux MADV_DONTNEED semantics.
Parents
rS362630: Fix few panics on NVMe's timing out initialization requests.
Branches
Unknown
Tags
Unknown