Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

David Hildenbrand and committed by
Andrew Morton
541541db 1a55ac60

+3 -4
+3 -4
mm/gup.c
··· 488 488 unsigned long addr, unsigned long end, 489 489 struct page **pages) 490 490 { 491 - struct page *start_page; 492 491 int nr; 493 492 494 - start_page = nth_page(page, (addr & (sz - 1)) >> PAGE_SHIFT); 493 + page += (addr & (sz - 1)) >> PAGE_SHIFT; 495 494 for (nr = 0; addr != end; nr++, addr += PAGE_SIZE) 496 - pages[nr] = nth_page(start_page, nr); 495 + pages[nr] = page++; 497 496 498 497 return nr; 499 498 } ··· 1511 1512 } 1512 1513 1513 1514 for (j = 0; j < page_increm; j++) { 1514 - subpage = nth_page(page, j); 1515 + subpage = page + j; 1515 1516 pages[i + j] = subpage; 1516 1517 flush_anon_page(vma, subpage, start + j * PAGE_SIZE); 1517 1518 flush_dcache_page(subpage);