lkml.org 
[lkml]   [2023]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RFC PATCH v2 12/47] hugetlb: add hugetlb_hgm_walk and hugetlb_walk_step
From
> + * @stop_at_none determines what we do when we encounter an empty PTE. If true,
> + * we return that PTE. If false and @sz is less than the current PTE's size,
> + * we make that PTE point to the next level down, going until @sz is the same
> + * as our current PTE.
[..]
> +int hugetlb_hgm_walk(struct mm_struct *mm, struct vm_area_struct *vma,
> + struct hugetlb_pte *hpte, unsigned long addr,
> + unsigned long sz, bool stop_at_none)
> +{
[..]
> + while (hugetlb_pte_size(hpte) > sz && !ret) {
> + pte = huge_ptep_get(hpte->ptep);
> + if (!pte_present(pte)) {
> + if (stop_at_none)
> + return 0;
> + if (unlikely(!huge_pte_none(pte)))
> + return -EEXIST;

If 'stop_at_none' means settling down on the just encountered empty PTE,
should the above two "if" clauses switch order? I thought Peter has
raised this question too, but I'm not seeing a response.

Regards,
-jane


> + } else if (hugetlb_pte_present_leaf(hpte, pte))
> + return 0;
> + ret = hugetlb_walk_step(mm, hpte, addr, sz);
> + }
> +
> + return ret;
> +}
> +

\
 
 \ /
  Last update: 2023-03-26 23:27    [W:0.047 / U:1.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site