> Introduce vma[_flags]_is_mm_backed() for the purposes of identifying
> mappings which are mm-managed and whose contents were placed there by core
> mm's own fault path - rather than a custom ->fault handler - and which core
> mm has not reserved the right to discard.
> 
> Mappings not managed by core mm do not fall into this category, as they are
> populated by their owner, and nor of course does memory-mapped I/O.
> 
> We exclude fixed mappings as these have a layout core mm cannot assume
> ordinary fault semantics over.
> 
> hugetlb mappings are fixed mappings, but core mm owns them entirely, so
> they are explicitly carved out as mm-backed, as the MADV_DODUMP check
> already does.
> 
> Droppable mappings are excluded as core mm has promised it may discard them
> at any time.
> 
> Use this functionality to update the madvise MADV_DODUMP check to test for
> this rather than open-coding it.
> 
> 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
> mm-managed mappings may not set VMA_IO_BIT, so we implicitly include
> these.
> 
> No functional change intended.
> 
> Acked-by: Zi Yan <[email protected]>
> Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/20261003-b4-mmap-prepare-vma-flag-sanify-v4-0-a1f052500...@kernel.org?part=30


Reply via email to