Thread (140 messages) 140 messages, 10 authors, 13d ago

Re: [PATCH 16/30] mm/vma: use vma_start_pgoff(), linear_page_index() in mm code

From: SJ Park <sj@kernel.org>
Date: 2026-06-30 00:12:09
Also in: damon, dri-devel, kvm, linux-arm-msm, linux-fsdevel, linux-iommu, linux-mm, linux-perf-users, linux-tegra, lkml, nvdimm

On Mon, 29 Jun 2026 13:23:27 +0100 Lorenzo Stoakes [off-list ref] wrote:
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.

Signed-off-by: Lorenzo Stoakes <ljs@kernel.org>
---
 include/linux/huge_mm.h    |  1 +
 include/linux/hugetlb.h    |  3 +--
 include/linux/pagemap.h    |  2 +-
 mm/damon/vaddr.c           |  5 +++--
I quickly looked only the DAMON part.  Looks nice and cleaner, thank you!

Reviewed-by: SJ Park <sj@kernel.org>


Thanks,
SJ

[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help