summaryrefslogtreecommitdiffstats
path: root/include/linux/rmap.h
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2023-01-11 14:28:57 +0000
committerAndrew Morton <akpm@linux-foundation.org>2023-02-02 22:32:57 -0800
commitc7f84b5723f1a60becd79d895ab214a7d5ee93c1 (patch)
treec4d4144edba7db974408f8d1feeaa15c20c3f58b /include/linux/rmap.h
parentdb4e5dbdcdd55482ab23bf4a0ae6746f93efb0d9 (diff)
downloadlinux-c7f84b5723f1a60becd79d895ab214a7d5ee93c1.tar.gz
linux-c7f84b5723f1a60becd79d895ab214a7d5ee93c1.tar.bz2
linux-c7f84b5723f1a60becd79d895ab214a7d5ee93c1.zip
mm: use entire_mapcount in __page_dup_rmap()
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/20230111142915.1001531-12-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux/rmap.h')
-rw-r--r--include/linux/rmap.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index aa682a2a93ce..a6bd1f0a183d 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -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)