summaryrefslogtreecommitdiff
path: root/mm/internal.h
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2023-08-21 14:26:20 -0700
committerAndrew Morton <akpm@linux-foundation.org>2023-08-21 14:26:20 -0700
commit5994eabf3bbbea550166ae90de0c854fc984c95d (patch)
tree6b242a70d3254c408c68157a5f5b2fa7eb9f6a4b /mm/internal.h
parente45a2e947dfa6da2d73e2cf91ed6399c12522d4f (diff)
parent6867c7a3320669cbe44b905a3eb35db725c6d470 (diff)
merge mm-hotfixes-stable into mm-stable to pick up depended-upon changes
Diffstat (limited to 'mm/internal.h')
-rw-r--r--mm/internal.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/mm/internal.h b/mm/internal.h
index c6ed10f0a5ad..d99ffb473f90 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -941,6 +941,13 @@ int migrate_device_coherent_page(struct page *page);
struct folio *try_grab_folio(struct page *page, int refs, unsigned int flags);
int __must_check try_grab_page(struct page *page, unsigned int flags);
+/*
+ * mm/huge_memory.c
+ */
+struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
+ unsigned long addr, pmd_t *pmd,
+ unsigned int flags);
+
enum {
/* mark page accessed */
FOLL_TOUCH = 1 << 16,
@@ -1015,6 +1022,16 @@ static inline bool gup_must_unshare(struct vm_area_struct *vma,
smp_rmb();
/*
+ * During GUP-fast we might not get called on the head page for a
+ * hugetlb page that is mapped using cont-PTE, because GUP-fast does
+ * not work with the abstracted hugetlb PTEs that always point at the
+ * head page. For hugetlb, PageAnonExclusive only applies on the head
+ * page (as it cannot be partially COW-shared), so lookup the head page.
+ */
+ if (unlikely(!PageHead(page) && PageHuge(page)))
+ page = compound_head(page);
+
+ /*
* Note that PageKsm() pages cannot be exclusive, and consequently,
* cannot get pinned.
*/