summaryrefslogtreecommitdiff
path: root/mm/gup.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2025-09-01 17:03:39 +0200
committerAndrew Morton <akpm@linux-foundation.org>2025-09-21 14:22:05 -0700
commit541541dbfeb84f0995ad1ec54a643c72081d46fc (patch)
tree914518ae5585832d582d3e42f7b9f6340aac324b /mm/gup.c
parent1a55ac6068ae4ca2024164c6d484d681a3f98299 (diff)
downloadlinux-541541dbfeb84f0995ad1ec54a643c72081d46fc.tar.gz
linux-541541dbfeb84f0995ad1ec54a643c72081d46fc.tar.bz2
linux-541541dbfeb84f0995ad1ec54a643c72081d46fc.zip
mm/gup: drop nth_page() usage within folio when recording subpages
nth_page() is no longer required when iterating over pages within a single folio, so let's just drop it when recording subpages. Link: https://lkml.kernel.org/r/20250901150359.867252-19-david@redhat.com Signed-off-by: David Hildenbrand <david@redhat.com> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/gup.c')
-rw-r--r--mm/gup.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/mm/gup.c b/mm/gup.c
index ed02d65f9c72..e1bd2b2e9145 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -488,12 +488,11 @@ static int record_subpages(struct page *page, unsigned long sz,
unsigned long addr, unsigned long end,
struct page **pages)
{
- struct page *start_page;
int nr;
- start_page = nth_page(page, (addr & (sz - 1)) >> PAGE_SHIFT);
+ page += (addr & (sz - 1)) >> PAGE_SHIFT;
for (nr = 0; addr != end; nr++, addr += PAGE_SIZE)
- pages[nr] = nth_page(start_page, nr);
+ pages[nr] = page++;
return nr;
}
@@ -1512,7 +1511,7 @@ next_page:
}
for (j = 0; j < page_increm; j++) {
- subpage = nth_page(page, j);
+ subpage = page + j;
pages[i + j] = subpage;
flush_anon_page(vma, subpage, start + j * PAGE_SIZE);
flush_dcache_page(subpage);