On Thu Sep 17, 2026 at 12:22 PM EDT, Lorenzo Stoakes (ARM) wrote: > Introduce vma[_flags]_is_persistent() for the purposes of identifying > mappings that are persistent in the sense that bytes to the mapping stay > there, and bytes read from the mapping are the same unless changed by > actions taken by userland. > > Kernel-owned mappings do not fall into this category, as their owner may > change the contents without the user having initiated it, and nor of course > does memory-mapped I/O. > > We exclude fixed mappings as these are singled out as being unmergeable and > so cannot be guaranteed to persist user data. > > hugetlb mappings are fixed mappings, but their contents are entirely the > user's, so they are explicitly carved out as persistent, as the MADV_DODUMP > check already does. > > It excludes droppable mappings, which by their nature are ephemeral. > > Use this functionality to update the madvise MADV_DODUMP check to test for > persistence rather than open-coding this. > > This replaces the VM_SPECIAL check which means it no longer checks for > VMA_IO_BIT, however this is safe as we have established the invariant that > only kernel-owned mappings may set VMA_IO_BIT, so we implicitly include > these. > > No functional change intended. > > Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]> > --- > include/linux/mm.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ > mm/madvise.c | 4 ++-- > 2 files changed, 46 insertions(+), 2 deletions(-) >
LGTM. Acked-by: Zi Yan <[email protected]> -- Best Regards, Yan, Zi
