mm/hugetlb: Fix build with !ARCH_WANT_HUGE_PMD_SHARE
Subsystems (2)
PATCH 1/1 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.
--- mm/hugetlb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
mm/hugetlb.c +5 -3
@@ -5469,9 +5469,6 @@ static bool vma_shareable(struct vm_area_struct *vma, unsigned long addr)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;
@@ -5616,6 +5613,11 @@ void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma, 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
Signature · 1 line
2.26.2
Quoted 6 lines · Peter Xu
want_pmd_share()is undefined with !ARCH_WANT_HUGE_PMD_SHARE since it's put by accident into a "#ifdefARCH_WANT_HUGE_PMD_SHARE" block. Moving it out won't work either sincevma_shareable()is only defined within the block. Define it for !ARCH_WANT_HUGE_PMD_SHARE instead.Fixes 5b109cc1cdcc ("hugetlb/userfaultfd: forbid huge pmd sharing when uffd enabled")
That commit id is from Andrew's tree and I don't think it is stable. There is a different id in the next tree. Not exactly sure how this is supposed to be handled.
Quoted 9 lines
Cc Andrew Morton <[email protected]>Cc Mike Kravetz <[email protected]>Cc Axel Rasmussen <[email protected]>Reported-by Naresh Kamboju <[email protected]>Tested-by Naresh Kamboju <[email protected]>Signed-off-by Peter Xu <[email protected]>--- mm/hugetlb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Thanks Peter,
Not your fault, but that header file is a bit of a mess.
Signature · 1 line
Mike Kravetz
Quoted 28 lines
mm/hugetlb.c +5
-3@@ -5469,9 +5469,6 @@ static bool vma_shareable(struct vm_area_struct *vma, unsigned long addr)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;@@ -5616,6 +5613,11 @@ void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma, 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
Quoted 11 lines · Mike Kravetz
Quoted 6 lines · Peter Xu
want_pmd_share()is undefined with !ARCH_WANT_HUGE_PMD_SHARE since it's put by accident into a "#ifdefARCH_WANT_HUGE_PMD_SHARE" block. Moving it out won't work either sincevma_shareable()is only defined within the block. Define it for !ARCH_WANT_HUGE_PMD_SHARE instead.Fixes 5b109cc1cdcc ("hugetlb/userfaultfd: forbid huge pmd sharing when uffd enabled")That commit id is from Andrew's tree and I don't think it is stable. There is a different id in the next tree. Not exactly sure how this is supposed to be handled.
I see - it'll be even better if this patch can be squashed into it.
Quoted 11 lines
Quoted 10 lines
Cc Andrew Morton <[email protected]>Cc Mike Kravetz <[email protected]>Cc Axel Rasmussen <[email protected]>Reported-by Naresh Kamboju <[email protected]>Tested-by Naresh Kamboju <[email protected]>Signed-off-by Peter Xu <[email protected]>--- mm/hugetlb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Quoted 4 lines
Thanks Peter,
Not your fault, but that header file is a bit of a mess.Reviewed-by Mike Kravetz <[email protected]>
I'm still guilty on not noticing this before since I still could.. I think it gives me some more clue to make less such mistake in the future.
Thanks for taking a quick look, Mike!
Signature · 1 line
Peter Xu