diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2023-01-11 14:28:56 +0000 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-02-02 22:32:56 -0800 |
commit | db4e5dbdcdd55482ab23bf4a0ae6746f93efb0d9 (patch) | |
tree | 086e8ce6bfb522c17f8eca8f9beece60734ba88d /mm/rmap.c | |
parent | 65a689f35ad7ebbfb79f429c1bc290b042ebb10b (diff) | |
download | linux-rpi-db4e5dbdcdd55482ab23bf4a0ae6746f93efb0d9.tar.gz linux-rpi-db4e5dbdcdd55482ab23bf4a0ae6746f93efb0d9.tar.bz2 linux-rpi-db4e5dbdcdd55482ab23bf4a0ae6746f93efb0d9.zip |
mm: use a folio in hugepage_add_anon_rmap() and hugepage_add_new_anon_rmap()
Remove uses of compound_mapcount_ptr()
Link: https://lkml.kernel.org/r/20230111142915.1001531-11-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/rmap.c')
-rw-r--r-- | mm/rmap.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mm/rmap.c b/mm/rmap.c index 513e23e5a158..0020474f46c1 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -2528,13 +2528,14 @@ void rmap_walk_locked(struct folio *folio, struct rmap_walk_control *rwc) void hugepage_add_anon_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address, rmap_t flags) { + struct folio *folio = page_folio(page); struct anon_vma *anon_vma = vma->anon_vma; int first; - BUG_ON(!PageLocked(page)); + BUG_ON(!folio_test_locked(folio)); BUG_ON(!anon_vma); /* address might be in next vma when migration races vma_adjust */ - first = atomic_inc_and_test(compound_mapcount_ptr(page)); + first = atomic_inc_and_test(&folio->_entire_mapcount); VM_BUG_ON_PAGE(!first && (flags & RMAP_EXCLUSIVE), page); VM_BUG_ON_PAGE(!first && PageAnonExclusive(page), page); if (first) @@ -2545,10 +2546,12 @@ void hugepage_add_anon_rmap(struct page *page, struct vm_area_struct *vma, void hugepage_add_new_anon_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address) { + struct folio *folio = page_folio(page); + BUG_ON(address < vma->vm_start || address >= vma->vm_end); /* increment count (starts at -1) */ - atomic_set(compound_mapcount_ptr(page), 0); - ClearHPageRestoreReserve(page); + atomic_set(&folio->_entire_mapcount, 0); + folio_clear_hugetlb_restore_reserve(folio); __page_set_anon_rmap(page, vma, address, 1); } #endif /* CONFIG_HUGETLB_PAGE */ |