Re: [PATCH] mm/hugetlb.c: fix a bug within a BUG(): inconsistent pte comparison

From: John Hubbard
Date: Fri Jun 30 2023 - 20:22:18 EST


On 6/30/23 03:07, Ryan Roberts wrote:
...
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index bce28cca73a1..73fbeb8f979f 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -7246,7 +7246,12 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,
pte = (pte_t *)pmd_alloc(mm, pud, addr);
}
}
- BUG_ON(pte && pte_present(ptep_get(pte)) && !pte_huge(ptep_get(pte)));
+
+ if (pte) {
+ pte_t pteval = ptep_get(pte);

Given the PTL is not held here, I think this should technically be
ptep_get_lockless()?


Oh yes. I'll change it to that and send a v2, thanks!


thanks,
--
John Hubbard
NVIDIA