mm/rmap: convert page_move_anon_rmap() to folio_move_anon_rmap()
authorDavid Hildenbrand <david@redhat.com>
Mon, 2 Oct 2023 14:29:48 +0000 (16:29 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 18 Oct 2023 21:34:14 +0000 (14:34 -0700)
Let's convert it to consume a folio.

[akpm@linux-foundation.org: fix kerneldoc]
Link: https://lkml.kernel.org/r/20231002142949.235104-3-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/rmap.h
mm/huge_memory.c
mm/hugetlb.c
mm/memory.c
mm/rmap.c

index d22f4d21a11ca7bbec64e055709b3fd3f651747a..b26fe858fd444ce3fe38a0b9147b822086c009b9 100644 (file)
@@ -189,7 +189,7 @@ typedef int __bitwise rmap_t;
 /*
  * rmap interfaces called when adding or removing pte of page
  */
-void page_move_anon_rmap(struct page *, struct vm_area_struct *);
+void folio_move_anon_rmap(struct folio *, struct vm_area_struct *);
 void page_add_anon_rmap(struct page *, struct vm_area_struct *,
                unsigned long address, rmap_t flags);
 void page_add_new_anon_rmap(struct page *, struct vm_area_struct *,
index 76ead290f1c82be897258c0cca189f05c837eafb..51a66eb48938af4ece6acac944b2e05d93424af1 100644 (file)
@@ -1376,7 +1376,7 @@ vm_fault_t do_huge_pmd_wp_page(struct vm_fault *vmf)
        if (folio_ref_count(folio) == 1) {
                pmd_t entry;
 
-               page_move_anon_rmap(page, vma);
+               folio_move_anon_rmap(folio, vma);
                SetPageAnonExclusive(page);
                folio_unlock(folio);
 reuse:
index 35d924f7497231f611ae1c9346e3b02327e121fc..7ad9d2159da4260883cb8431ee184fb970dcd3a9 100644 (file)
@@ -5653,7 +5653,7 @@ retry_avoidcopy:
         */
        if (folio_mapcount(old_folio) == 1 && folio_test_anon(old_folio)) {
                if (!PageAnonExclusive(&old_folio->page)) {
-                       page_move_anon_rmap(&old_folio->page, vma);
+                       folio_move_anon_rmap(old_folio, vma);
                        SetPageAnonExclusive(&old_folio->page);
                }
                if (likely(!unshare))
index 21fba1c9a6c730d9283bf2cd4117f14e172ff026..6c67828f934c571c0727c3121182fe5846eebdcc 100644 (file)
@@ -3480,7 +3480,7 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf)
                 * and the folio is locked, it's dark out, and we're wearing
                 * sunglasses. Hit it.
                 */
-               page_move_anon_rmap(vmf->page, vma);
+               folio_move_anon_rmap(folio, vma);
                SetPageAnonExclusive(vmf->page);
                folio_unlock(folio);
 reuse:
index 6f1ea1491118c5ca0622cba3a0c0c832ce333418..7a27a2b418021005f7345b08d2940fffd859530c 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1128,19 +1128,17 @@ int folio_total_mapcount(struct folio *folio)
 }
 
 /**
- * page_move_anon_rmap - move a page to our anon_vma
- * @page:      the page to move to our anon_vma
- * @vma:       the vma the page belongs to
+ * folio_move_anon_rmap - move a folio to our anon_vma
+ * @folio:     The folio to move to our anon_vma
+ * @vma:       The vma the folio belongs to
  *
- * When a page belongs exclusively to one process after a COW event,
- * that page can be moved into the anon_vma that belongs to just that
- * process, so the rmap code will not search the parent or sibling
- * processes.
+ * When a folio belongs exclusively to one process after a COW event,
+ * that folio can be moved into the anon_vma that belongs to just that
+ * process, so the rmap code will not search the parent or sibling processes.
  */
-void page_move_anon_rmap(struct page *page, struct vm_area_struct *vma)
+void folio_move_anon_rmap(struct folio *folio, struct vm_area_struct *vma)
 {
        void *anon_vma = vma->anon_vma;
-       struct folio *folio = page_folio(page);
 
        VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
        VM_BUG_ON_VMA(!anon_vma, vma);