Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rmap: convert page_move_anon_rmap() to use a folio

Removes one call to compound_head() and a reference to page->mapping.

Link: https://lkml.kernel.org/r/20220902194653.1739778-50-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
595af4c9 3b344157

+6 -8
+6 -8
mm/rmap.c
··· 1099 1099 */ 1100 1100 void page_move_anon_rmap(struct page *page, struct vm_area_struct *vma) 1101 1101 { 1102 - struct anon_vma *anon_vma = vma->anon_vma; 1103 - struct page *subpage = page; 1102 + void *anon_vma = vma->anon_vma; 1103 + struct folio *folio = page_folio(page); 1104 1104 1105 - page = compound_head(page); 1106 - 1107 - VM_BUG_ON_PAGE(!PageLocked(page), page); 1105 + VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); 1108 1106 VM_BUG_ON_VMA(!anon_vma, vma); 1109 1107 1110 - anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; 1108 + anon_vma += PAGE_MAPPING_ANON; 1111 1109 /* 1112 1110 * Ensure that anon_vma and the PAGE_MAPPING_ANON bit are written 1113 1111 * simultaneously, so a concurrent reader (eg folio_referenced()'s 1114 1112 * folio_test_anon()) will not see one without the other. 1115 1113 */ 1116 - WRITE_ONCE(page->mapping, (struct address_space *) anon_vma); 1117 - SetPageAnonExclusive(subpage); 1114 + WRITE_ONCE(folio->mapping, anon_vma); 1115 + SetPageAnonExclusive(page); 1118 1116 } 1119 1117 1120 1118 /**