Re: [PATCH v3] mm/hugetlb: fix a addressing exception caused by huge_pte_offset

From: Jason Gunthorpe
Date: Fri Mar 27 2020 - 08:11:07 EST


On Fri, Mar 27, 2020 at 09:40:07AM +0800, Longpeng(Mike) wrote:
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index dd8737a..d4fab68 100644
> +++ b/mm/hugetlb.c
> @@ -4909,29 +4909,33 @@ pte_t *huge_pte_offset(struct mm_struct *mm,
> unsigned long addr, unsigned long sz)
> {
> pgd_t *pgd;
> - p4d_t *p4d;
> - pud_t *pud;
> - pmd_t *pmd;
> + p4d_t *p4g, p4d_entry;
> + pud_t *pud, pud_entry;
> + pmd_t *pmd, pmd_entry;
>
> pgd = pgd_offset(mm, addr);
> if (!pgd_present(*pgd))
> return NULL;
> - p4d = p4d_offset(pgd, addr);
> - if (!p4d_present(*p4d))
> +
> + p4g = p4d_offset(pgd, addr);

Why p4g here? Shouldn't it be p4d?

Jason