Commit 595af4c9 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

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.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 3b344157
...@@ -1099,22 +1099,20 @@ int pfn_mkclean_range(unsigned long pfn, unsigned long nr_pages, pgoff_t pgoff, ...@@ -1099,22 +1099,20 @@ int pfn_mkclean_range(unsigned long pfn, unsigned long nr_pages, pgoff_t pgoff,
*/ */
void page_move_anon_rmap(struct page *page, struct vm_area_struct *vma) void page_move_anon_rmap(struct page *page, struct vm_area_struct *vma)
{ {
struct anon_vma *anon_vma = vma->anon_vma; void *anon_vma = vma->anon_vma;
struct page *subpage = page; struct folio *folio = page_folio(page);
page = compound_head(page);
VM_BUG_ON_PAGE(!PageLocked(page), page); VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
VM_BUG_ON_VMA(!anon_vma, vma); VM_BUG_ON_VMA(!anon_vma, vma);
anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; anon_vma += PAGE_MAPPING_ANON;
/* /*
* Ensure that anon_vma and the PAGE_MAPPING_ANON bit are written * Ensure that anon_vma and the PAGE_MAPPING_ANON bit are written
* simultaneously, so a concurrent reader (eg folio_referenced()'s * simultaneously, so a concurrent reader (eg folio_referenced()'s
* folio_test_anon()) will not see one without the other. * folio_test_anon()) will not see one without the other.
*/ */
WRITE_ONCE(page->mapping, (struct address_space *) anon_vma); WRITE_ONCE(folio->mapping, anon_vma);
SetPageAnonExclusive(subpage); SetPageAnonExclusive(page);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment