Skip to content

Commit ffe1e78

Browse files
xzpeterakpm00
authored andcommitted
mm/gup: cleanup next_page handling
The only path that doesn't use generic "**pages" handling is the gate vma. Make it use the same path, meanwhile tune the next_page label upper to cover "**pages" handling. This prepares for THP handling for "**pages". Link: https://lkml.kernel.org/r/20230628215310.73782-5-peterx@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Lorenzo Stoakes <lstoakes@gmail.com> Acked-by: David Hildenbrand <david@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: James Houghton <jthoughton@google.com> Cc: Jason Gunthorpe <jgg@nvidia.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Kirill A . Shutemov <kirill@shutemov.name> Cc: Matthew Wilcox <willy@infradead.org> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Mike Rapoport (IBM) <rppt@kernel.org> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Yang Shi <shy828301@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 5502ea4 commit ffe1e78

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

mm/gup.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ static long __get_user_pages(struct mm_struct *mm,
12071207
if (!vma && in_gate_area(mm, start)) {
12081208
ret = get_gate_page(mm, start & PAGE_MASK,
12091209
gup_flags, &vma,
1210-
pages ? &pages[i] : NULL);
1210+
pages ? &page : NULL);
12111211
if (ret)
12121212
goto out;
12131213
ctx.page_mask = 0;
@@ -1277,19 +1277,18 @@ static long __get_user_pages(struct mm_struct *mm,
12771277
ret = PTR_ERR(page);
12781278
goto out;
12791279
}
1280-
1281-
goto next_page;
12821280
} else if (IS_ERR(page)) {
12831281
ret = PTR_ERR(page);
12841282
goto out;
12851283
}
1284+
next_page:
12861285
if (pages) {
12871286
pages[i] = page;
12881287
flush_anon_page(vma, page, start);
12891288
flush_dcache_page(page);
12901289
ctx.page_mask = 0;
12911290
}
1292-
next_page:
1291+
12931292
page_increm = 1 + (~(start >> PAGE_SHIFT) & ctx.page_mask);
12941293
if (page_increm > nr_pages)
12951294
page_increm = nr_pages;

0 commit comments

Comments
 (0)