[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f9f271b6-9888-7e92-8054-f48a9ca3e233@oracle.com>
Date: Wed, 4 Jan 2023 17:12:33 -0800
From: Jane Chu <jane.chu@...cle.com>
To: James Houghton <jthoughton@...gle.com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Muchun Song <songmuchun@...edance.com>,
Peter Xu <peterx@...hat.com>
Cc: David Hildenbrand <david@...hat.com>,
David Rientjes <rientjes@...gle.com>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Mina Almasry <almasrymina@...gle.com>,
Zach O'Keefe <zokeefe@...gle.com>,
Manish Mishra <manish.mishra@...anix.com>,
Naoya Horiguchi <naoya.horiguchi@....com>,
"Dr . David Alan Gilbert" <dgilbert@...hat.com>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Vlastimil Babka <vbabka@...e.cz>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Miaohe Lin <linmiaohe@...wei.com>,
Yang Shi <shy828301@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v2 12/47] hugetlb: add hugetlb_hgm_walk and
hugetlb_walk_step
On 1/4/2023 4:57 PM, Jane Chu wrote:
>> + * @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)
>> +{
Also here below, the way 'stop_at_none' is used when HGM isn't enabled
is puzzling. Could you elaborate please?
+ if (!hugetlb_hgm_enabled(vma)) {
+ if (stop_at_none)
+ return 0;
+ return sz == huge_page_size(hstate_vma(vma)) ? 0 : -EINVAL;
+ }
> [..]
>> + 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;
>> +}
>> +
>
>
thanks,
-jane
Powered by blists - more mailing lists