diff options
| author | Lorenzo Stoakes <ljs@kernel.org> | 2026-07-10 21:16:59 +0100 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-08-04 19:19:00 -0700 |
| commit | 5872168de5d5c1f69a2efcf80e331c32aa08ec9a (patch) | |
| tree | 69b6d34c05bfe47857acda86eea6d5a3a2ff9057 /mm/util.c | |
| parent | 1268e1572ba545b75e11fbc33380f85a5d1ec1db (diff) | |
| download | linux-next-5872168de5d5c1f69a2efcf80e331c32aa08ec9a.tar.gz linux-next-5872168de5d5c1f69a2efcf80e331c32aa08ec9a.zip | |
mm/vma: use vma_start_pgoff(), linear_page_index() in mm code
There are many instances in which linear_page_index() (as well as
linear_page_delta()) is open-coded, which is confusing and inconsistent.
Additionally, vma->vm_pgoff doesn't necessarily make it clear that this is
the page offset of the start of the VMA range.
Doing so also aids greppability.
So use vma_start_pgoff() in favour of directly accessing vma->vm_pgoff, and
linear_page_index() where we can.
This also lays the ground for future changes which will add an anonymous
page offset in order to be able to index MAP_PRIVATE-file backed anon
folios in terms of their virtual page offset.
No functional change intended.
Link: https://lore.kernel.org/20260710-b4-pre-scalable-cow-v2-18-2a5aa403d977@kernel.org
Signed-off-by: Lorenzo Stoakes <ljs@kernel.org>
Reviewed-by: Gregory Price <gourry@gourry.net>
Reviewed-by: SJ Park <sj@kernel.org>
Reviewed-by: Pedro Falcato <pfalcato@suse.de>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Cc: Ackerley Tng <ackerleytng@google.com>
Cc: David Hildenbrand (Arm) <david@kernel.org>
Cc: Kai Huang <kai.huang@intel.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Liam R. Howlett (Oracle) <liam@infradead.org>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/util.c')
| -rw-r--r-- | mm/util.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/util.c b/mm/util.c index 34cb43b3eaa4..5090457542ca 100644 --- a/mm/util.c +++ b/mm/util.c @@ -1188,7 +1188,7 @@ void compat_set_desc_from_vma(struct vm_area_desc *desc, desc->start = vma->vm_start; desc->end = vma->vm_end; - desc->pgoff = vma->vm_pgoff; + desc->pgoff = vma_start_pgoff(vma); desc->vm_file = vma->vm_file; desc->vma_flags = vma->flags; desc->page_prot = vma->vm_page_prot; @@ -1379,7 +1379,7 @@ static int call_vma_mapped(struct vm_area_struct *vma) if (!vm_ops || !vm_ops->mapped) return 0; - err = vm_ops->mapped(vma->vm_start, vma->vm_end, vma->vm_pgoff, + err = vm_ops->mapped(vma->vm_start, vma->vm_end, vma_start_pgoff(vma), vma->vm_file, &vm_private_data); if (err) return err; |
