Skip to content

Commit

Permalink
mm: use entire_mapcount in __page_dup_rmap()
Browse files Browse the repository at this point in the history
Remove the use of the compound_mapcount_ptr() wrapper, and add an
assertion that we're not passing a tail page if we're duplicating a PMD.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
Matthew Wilcox (Oracle) authored and akpm00 committed Feb 3, 2023
1 parent db4e5db commit c7f84b5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/linux/rmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,14 @@ void hugepage_add_new_anon_rmap(struct page *, struct vm_area_struct *,

static inline void __page_dup_rmap(struct page *page, bool compound)
{
atomic_inc(compound ? compound_mapcount_ptr(page) : &page->_mapcount);
if (compound) {
struct folio *folio = (struct folio *)page;

VM_BUG_ON_PAGE(compound && !PageHead(page), page);
atomic_inc(&folio->_entire_mapcount);
} else {
atomic_inc(&page->_mapcount);
}
}

static inline void page_dup_file_rmap(struct page *page, bool compound)
Expand Down

0 comments on commit c7f84b5

Please sign in to comment.