Skip to content

Commit 595af4c

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
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/[email protected] Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 3b34415 commit 595af4c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

mm/rmap.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,22 +1099,20 @@ int pfn_mkclean_range(unsigned long pfn, unsigned long nr_pages, pgoff_t pgoff,
10991099
*/
11001100
void page_move_anon_rmap(struct page *page, struct vm_area_struct *vma)
11011101
{
1102-
struct anon_vma *anon_vma = vma->anon_vma;
1103-
struct page *subpage = page;
1104-
1105-
page = compound_head(page);
1102+
void *anon_vma = vma->anon_vma;
1103+
struct folio *folio = page_folio(page);
11061104

1107-
VM_BUG_ON_PAGE(!PageLocked(page), page);
1105+
VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
11081106
VM_BUG_ON_VMA(!anon_vma, vma);
11091107

1110-
anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON;
1108+
anon_vma += PAGE_MAPPING_ANON;
11111109
/*
11121110
* Ensure that anon_vma and the PAGE_MAPPING_ANON bit are written
11131111
* simultaneously, so a concurrent reader (eg folio_referenced()'s
11141112
* folio_test_anon()) will not see one without the other.
11151113
*/
1116-
WRITE_ONCE(page->mapping, (struct address_space *) anon_vma);
1117-
SetPageAnonExclusive(subpage);
1114+
WRITE_ONCE(folio->mapping, anon_vma);
1115+
SetPageAnonExclusive(page);
11181116
}
11191117

11201118
/**

0 commit comments

Comments
 (0)