Skip to contentSkip to conversation

mm/rmap: convert __page_check_anon_rmap() to folio

PATCH In review Yajun Deng 3 participants 3 messages Sep 15, 2023

Subsystems (2)
lore
Share & tools
lore

Yajun Deng

author
#0 lore raw

PATCH 1/1 mm/rmap: convert __page_check_anon_rmap() to folio

The parameter page in __page_check_anon_rmap() is redundant. Remove it, and convert __page_check_anon_rmap() to __folio_check_anon_rmap().

---
 mm/rmap.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
mm/rmap.c +5 -6
index 789a2beb8b3a..520607f4d91c 100644
@@ -1154,13 +1154,12 @@ static void __folio_set_anon(struct folio *folio, struct vm_area_struct *vma,
 }
 
 /**
- * __page_check_anon_rmap - sanity check anonymous rmap addition
+ * __folio_check_anon_rmap - sanity check anonymous rmap addition
  * @folio:	The folio containing @page.
- * @page:	the page to check the mapping of
  * @vma:	the vm area in which the mapping is added
  * @address:	the user virtual address mapped
  */
-static void __page_check_anon_rmap(struct folio *folio, struct page *page,
+static void __folio_check_anon_rmap(struct folio *folio,
 	struct vm_area_struct *vma, unsigned long address)
 {
 	/*
@@ -1176,8 +1175,8 @@ static void __page_check_anon_rmap(struct folio *folio, struct page *page,
 	 */
 	VM_BUG_ON_FOLIO(folio_anon_vma(folio)->root != vma->anon_vma->root,
 			folio);
-	VM_BUG_ON_PAGE(page_to_pgoff(page) != linear_page_index(vma, address),
-		       page);
+	VM_BUG_ON_FOLIO(folio_pgoff(folio) != linear_page_index(vma, address),
+		       folio);
 }
 
 /**
@@ -1245,7 +1244,7 @@ void page_add_anon_rmap(struct page *page, struct vm_area_struct *vma,
 		__folio_set_anon(folio, vma, address,
 				 !!(flags & RMAP_EXCLUSIVE));
 	} else if (likely(!folio_test_ksm(folio))) {
-		__page_check_anon_rmap(folio, page, vma, address);
+		__folio_check_anon_rmap(folio, vma, address);
 	}
 	if (flags & RMAP_EXCLUSIVE)
 		SetPageAnonExclusive(page);
Signature · 1 line
2.25.1
#1 lore raw

mm/rmap.c static void __page_check_anon_rmap(struct folio *folio, struct page *page, · line 1179

Quoted 8 lines · Yajun Deng
mm/rmap.c +2 -2
@@ -1176,8 +1175,8 @@ static void __page_check_anon_rmap(struct folio *folio, struct page *page,
 	 */
 	VM_BUG_ON_FOLIO(folio_anon_vma(folio)->root != vma->anon_vma->root,
 			folio);
-	VM_BUG_ON_PAGE(page_to_pgoff(page) != linear_page_index(vma, address),
-		       page);
+	VM_BUG_ON_FOLIO(folio_pgoff(folio) != linear_page_index(vma, address),
+		       folio);

No, this is not equivalent. You haven't hit any problems testing it because you don't have large anonymous folios.

#2 lore raw
Quoted 12 lines · Matthew Wilcox

mm/rmap.c static void __page_check_anon_rmap(struct folio *folio, struct page *page, · line 1179

Quoted 8 lines · Yajun Deng
mm/rmap.c +2 -2
@@ -1176,8 +1175,8 @@ static void __page_check_anon_rmap(struct folio *folio, struct page *page,
  	 */
  	VM_BUG_ON_FOLIO(folio_anon_vma(folio)->root != vma->anon_vma->root,
  			folio);
-	VM_BUG_ON_PAGE(page_to_pgoff(page) != linear_page_index(vma, address),
-		       page);
+	VM_BUG_ON_FOLIO(folio_pgoff(folio) != linear_page_index(vma, address),
+		       folio);

No, this is not equivalent. You haven't hit any problems testing it because you don't have large anonymous folios.

Right, the address would have to be adjusted as well by the caller.

Signature · 3 lines
Cheers,

David / dhildenb