get_user_page_vma_remote() faults in the page at @addr in a remote mm and also looks up the VMA that covers it, handing both back to the caller.
This cleans up the name space for adding a get_user_page_vma() variant where the caller already has the vma. Assisted-by: Claude:claude-opus-4.8 Signed-off-by: Rik van Riel <[email protected]> --- arch/arm64/kernel/mte.c | 2 +- arch/x86/kernel/uprobes.c | 2 +- include/linux/mm.h | 2 +- mm/memory.c | 4 ++-- mm/rmap.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c index 1a9aad6ef22a..7a6ecc3d9294 100644 --- a/arch/arm64/kernel/mte.c +++ b/arch/arm64/kernel/mte.c @@ -459,7 +459,7 @@ static int __access_remote_tags(struct mm_struct *mm, unsigned long addr, struct vm_area_struct *vma; unsigned long tags, offset; void *maddr; - struct page *page = get_user_page_vma_remote(mm, addr, + struct page *page = get_user_page_lookup_vma(mm, addr, gup_flags, &vma); struct folio *folio; diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c index 3af979fb41d3..329efac0cfb3 100644 --- a/arch/x86/kernel/uprobes.c +++ b/arch/x86/kernel/uprobes.c @@ -1036,7 +1036,7 @@ static int copy_from_vaddr(struct mm_struct *mm, unsigned long vaddr, void *dst, struct vm_area_struct *vma; struct page *page; - page = get_user_page_vma_remote(mm, vaddr, gup_flags, &vma); + page = get_user_page_lookup_vma(mm, vaddr, gup_flags, &vma); if (IS_ERR(page)) return PTR_ERR(page); uprobe_copy_from_page(page, vaddr, dst, len); diff --git a/include/linux/mm.h b/include/linux/mm.h index 485df9c2dbdd..24ead14b4790 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3238,7 +3238,7 @@ long pin_user_pages_remote(struct mm_struct *mm, /* * Retrieves a single page alongside its VMA. Does not support FOLL_NOWAIT. */ -static inline struct page *get_user_page_vma_remote(struct mm_struct *mm, +static inline struct page *get_user_page_lookup_vma(struct mm_struct *mm, unsigned long addr, int gup_flags, struct vm_area_struct **vmap) diff --git a/mm/memory.c b/mm/memory.c index ff338c2abe92..3b86eeaf084f 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -7039,7 +7039,7 @@ static int __access_remote_vm(struct mm_struct *mm, unsigned long addr, void *maddr; struct folio *folio; struct vm_area_struct *vma = NULL; - struct page *page = get_user_page_vma_remote(mm, addr, + struct page *page = get_user_page_lookup_vma(mm, addr, gup_flags, &vma); if (IS_ERR(page)) { @@ -7167,7 +7167,7 @@ static int __copy_remote_vm_str(struct mm_struct *mm, unsigned long addr, struct page *page; struct vm_area_struct *vma = NULL; - page = get_user_page_vma_remote(mm, addr, gup_flags, &vma); + page = get_user_page_lookup_vma(mm, addr, gup_flags, &vma); if (IS_ERR(page)) { /* * Treat as a total failure for now until we decide how diff --git a/mm/rmap.c b/mm/rmap.c index 1c77d5dc06e9..b36f2e219b8f 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -2838,7 +2838,7 @@ struct page *make_device_exclusive(struct mm_struct *mm, unsigned long addr, * (non-device-exclusive) PTE and issue a MMU_NOTIFY_EXCLUSIVE. */ retry: - page = get_user_page_vma_remote(mm, addr, + page = get_user_page_lookup_vma(mm, addr, FOLL_GET | FOLL_WRITE | FOLL_SPLIT_PMD, &vma); if (IS_ERR(page)) -- 2.53.0-Meta
