Re: [PATCH v4 03/20] mm: introduce linear_anon_page_index()
"David Hildenbrand (Arm)" <[email protected]>
| Newsgroups | gmane.comp.freedesktop.amd-gfx,gmane.linux.kernel.mm,gmane.linux.kernel,gmane.linux.file-systems,gmane.comp.emulators.kvm.devel,gmane.comp.video.dri.devel,gmane.linux.kernel.perf.user |
|---|---|
| Message-ID | <[email protected]> |
On 8/6/26 22:21, Lorenzo Stoakes (ARM) wrote: > This function provides the anonymous equivalent of linear_page_index(), > instead offsetting based on the anonymous page offset of the VMA. > > It is valid only for anonymous or MAP_PRIVATE file-backed mappings, in > other words CoW mappings. > > For pure anon VMAs, this will be equal to linear_page_index(). > > Assert that both of these invariants are true In linear_anon_page_index() > and implement the algorithm in __linear_anon_page_index(). > > Note that MAP_PRIVATE-/dev/zero mappings will satisfy vma_is_anonymous() > but not fulfill this invariant, so when asserting this we check > vma->vm_file to account for this. > > We do not update callsites yet, so no functional change intended. > > Also const-ify vma_is_anonymous() to make it compatible with the > const-ified linear_anon_page_index(). > > While we're here, update linear_page_index() to be more succinct. > > VMA userland tests are also updated accordingly. > > Reviewed-by: Gregory Price (Meta) <[email protected]> > Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]> > --- Acked-by: David Hildenbrand (Arm) <[email protected]> -- Cheers, David