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
