mm/gup: convert to arch_make_folio_accessible()
authorDavid Hildenbrand <david@redhat.com>
Mon, 29 Jul 2024 18:38:43 +0000 (20:38 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 2 Sep 2024 03:25:52 +0000 (20:25 -0700)
Let's use arch_make_folio_accessible() instead so we can get rid of
arch_make_page_accessible().

Link: https://lkml.kernel.org/r/20240729183844.388481-3-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Janosch Frank <frankja@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/gup.c

index 120740c..3e8484c 100644 (file)
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -819,6 +819,7 @@ static struct page *follow_page_pte(struct vm_area_struct *vma,
                struct dev_pagemap **pgmap)
 {
        struct mm_struct *mm = vma->vm_mm;
+       struct folio *folio;
        struct page *page;
        spinlock_t *ptl;
        pte_t *ptep, pte;
@@ -876,6 +877,7 @@ static struct page *follow_page_pte(struct vm_area_struct *vma,
                        goto out;
                }
        }
+       folio = page_folio(page);
 
        if (!pte_write(pte) && gup_must_unshare(vma, flags, page)) {
                page = ERR_PTR(-EMLINK);
@@ -886,7 +888,7 @@ static struct page *follow_page_pte(struct vm_area_struct *vma,
                       !PageAnonExclusive(page), page);
 
        /* try_grab_folio() does nothing unless FOLL_GET or FOLL_PIN is set. */
-       ret = try_grab_folio(page_folio(page), 1, flags);
+       ret = try_grab_folio(folio, 1, flags);
        if (unlikely(ret)) {
                page = ERR_PTR(ret);
                goto out;
@@ -898,7 +900,7 @@ static struct page *follow_page_pte(struct vm_area_struct *vma,
         * Documentation/core-api/pin_user_pages.rst for details.
         */
        if (flags & FOLL_PIN) {
-               ret = arch_make_page_accessible(page);
+               ret = arch_make_folio_accessible(folio);
                if (ret) {
                        unpin_user_page(page);
                        page = ERR_PTR(ret);
@@ -2919,7 +2921,7 @@ static int gup_fast_pte_range(pmd_t pmd, pmd_t *pmdp, unsigned long addr,
                 * details.
                 */
                if (flags & FOLL_PIN) {
-                       ret = arch_make_page_accessible(page);
+                       ret = arch_make_folio_accessible(folio);
                        if (ret) {
                                gup_put_folio(folio, 1, flags);
                                goto pte_unmap;