The patch titled Subject: mm/hugetlb: fix build with !ARCH_WANT_HUGE_PMD_SHARE has been added to the -mm tree. Its filename is hugetlb-userfaultfd-forbid-huge-pmd-sharing-when-uffd-enabled-fix.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/hugetlb-userfaultfd-forbid-huge-pmd-sharing-when-uffd-enabled-fix.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/hugetlb-userfaultfd-forbid-huge-pmd-sharing-when-uffd-enabled-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Peter Xu <peterx@xxxxxxxxxx> Subject: mm/hugetlb: fix build with !ARCH_WANT_HUGE_PMD_SHARE want_pmd_share() is undefined with !ARCH_WANT_HUGE_PMD_SHARE since it's put by accident into a "#ifdef ARCH_WANT_HUGE_PMD_SHARE" block. Moving it out won't work either since vma_shareable() is only defined within the block. Define it for !ARCH_WANT_HUGE_PMD_SHARE instead. Link: https://lkml.kernel.org/r/20210310185359.88297-1-peterx@xxxxxxxxxx Fixes: 5b109cc1cdcc ("hugetlb/userfaultfd: forbid huge pmd sharing when uffd enabled") Signed-off-by: Peter Xu <peterx@xxxxxxxxxx> Reported-by: Naresh Kamboju <naresh.kamboju@xxxxxxxxxx> Tested-by: Naresh Kamboju <naresh.kamboju@xxxxxxxxxx> Reviewed-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Axel Rasmussen <axelrasmussen@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/mm/hugetlb.c~hugetlb-userfaultfd-forbid-huge-pmd-sharing-when-uffd-enabled-fix +++ a/mm/hugetlb.c @@ -5329,9 +5329,6 @@ static bool vma_shareable(struct vm_area bool want_pmd_share(struct vm_area_struct *vma, unsigned long addr) { -#ifndef CONFIG_ARCH_WANT_HUGE_PMD_SHARE - return false; -#endif #ifdef CONFIG_USERFAULTFD if (uffd_disable_huge_pmd_share(vma)) return false; @@ -5476,6 +5473,11 @@ void adjust_range_if_pmd_sharing_possibl unsigned long *start, unsigned long *end) { } + +bool want_pmd_share(struct vm_area_struct *vma, unsigned long addr) +{ + return false; +} #endif /* CONFIG_ARCH_WANT_HUGE_PMD_SHARE */ #ifdef CONFIG_ARCH_WANT_GENERAL_HUGETLB _ Patches currently in -mm which might be from peterx@xxxxxxxxxx are hugetlb-dedup-the-code-to-add-a-new-file_region.patch hugetlg-break-earlier-in-add_reservation_in_range-when-we-can.patch mm-introduce-page_needs_cow_for_dma-for-deciding-whether-cow.patch mm-use-is_cow_mapping-across-tree-where-proper.patch hugetlb-do-early-cow-when-page-pinned-on-src-mm.patch hugetlb-pass-vma-into-huge_pte_alloc-and-huge_pmd_share.patch hugetlb-pass-vma-into-huge_pte_alloc-and-huge_pmd_share-fix.patch hugetlb-userfaultfd-forbid-huge-pmd-sharing-when-uffd-enabled.patch hugetlb-userfaultfd-forbid-huge-pmd-sharing-when-uffd-enabled-fix.patch mm-hugetlb-move-flush_hugetlb_tlb_range-into-hugetlbh.patch hugetlb-userfaultfd-unshare-all-pmds-for-hugetlbfs-when-register-wp.patch