lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1D4FF375-08FF-41E0-9B59-CDFCA6293438@nvidia.com>
Date: Thu, 21 Aug 2025 10:09:10 -0400
From: Zi Yan <ziy@...dia.com>
To: Wei Yang <richard.weiyang@...il.com>
Cc: Nico Pache <npache@...hat.com>,
 Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, linux-mm@...ck.org,
 linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-trace-kernel@...r.kernel.org, david@...hat.com,
 baolin.wang@...ux.alibaba.com, Liam.Howlett@...cle.com, ryan.roberts@....com,
 dev.jain@....com, corbet@....net, rostedt@...dmis.org, mhiramat@...nel.org,
 mathieu.desnoyers@...icios.com, akpm@...ux-foundation.org, baohua@...nel.org,
 willy@...radead.org, peterx@...hat.com, wangkefeng.wang@...wei.com,
 usamaarif642@...il.com, sunnanyong@...wei.com, vishal.moola@...il.com,
 thomas.hellstrom@...ux.intel.com, yang@...amperecomputing.com,
 kirill.shutemov@...ux.intel.com, aarcange@...hat.com, raquini@...hat.com,
 anshuman.khandual@....com, catalin.marinas@....com, tiwai@...e.de,
 will@...nel.org, dave.hansen@...ux.intel.com, jack@...e.cz, cl@...two.org,
 jglisse@...gle.com, surenb@...gle.com, zokeefe@...gle.com,
 hannes@...xchg.org, rientjes@...gle.com, mhocko@...e.com,
 rdunlap@...radead.org, hughd@...gle.com
Subject: Re: [PATCH v10 03/13] khugepaged: generalize hugepage_vma_revalidate
 for mTHP support

On 20 Aug 2025, at 23:41, Wei Yang wrote:

> On Wed, Aug 20, 2025 at 09:40:40AM -0600, Nico Pache wrote:
> [...]
>>>
>>>>       if (!thp_vma_suitable_order(vma, address, PMD_ORDER))
>>>>               return SCAN_ADDRESS_RANGE;
>>>> -     if (!thp_vma_allowable_order(vma, vma->vm_flags, type, PMD_ORDER))
>>>> +     if (!thp_vma_allowable_orders(vma, vma->vm_flags, type, orders))
>>>>               return SCAN_VMA_CHECK;
>>>>       /*
>>>>        * Anon VMA expected, the address may be unmapped then
>>>> @@ -1134,7 +1135,8 @@ static int collapse_huge_page(struct mm_struct *mm, unsigned long address,
>>>>               goto out_nolock;
>>>>
>>>>       mmap_read_lock(mm);
>>>> -     result = hugepage_vma_revalidate(mm, address, true, &vma, cc);
>>>> +     result = hugepage_vma_revalidate(mm, address, true, &vma, cc,
>>>> +                                      BIT(HPAGE_PMD_ORDER));
>>>
>>> Shouldn't this be PMD order? Seems equivalent.
>> Yeah i'm actually not sure why we have both... they seem to be the
>> same thing, but perhaps there is some reason for having two...
>
> I am confused with these two, PMD_ORDER above and HPAGE_PMD_ORDER from here.
>
> Do we have a guide on when to use which?

Looking at the definition of HPAGE_PMD_SHIFT in huge_mm.h, it will cause a
build bug when PMD level huge page is not supported. So I think
HPAGE_PMD_ORDER should be used for all huge pages (both THP and hugetlb).

>
>>>
>>>>       if (result != SCAN_SUCCEED) {
>>>>               mmap_read_unlock(mm);
>>>>               goto out_nolock;
>>>> @@ -1168,7 +1170,8 @@ static int collapse_huge_page(struct mm_struct *mm, unsigned long address,
>>>>        * mmap_lock.
>>>>        */
>>>>       mmap_write_lock(mm);
>>>> -     result = hugepage_vma_revalidate(mm, address, true, &vma, cc);
>>>> +     result = hugepage_vma_revalidate(mm, address, true, &vma, cc,
>>>> +                                      BIT(HPAGE_PMD_ORDER));
>>>>       if (result != SCAN_SUCCEED)
>>>>               goto out_up_write;
>>>>       /* check if the pmd is still valid */
>>>> @@ -2807,7 +2810,7 @@ int madvise_collapse(struct vm_area_struct *vma, unsigned long start,
>>>>                       mmap_read_lock(mm);
>>>>                       mmap_locked = true;
>>>>                       result = hugepage_vma_revalidate(mm, addr, false, &vma,
>>>> -                                                      cc);
>>>> +                                                      cc, BIT(HPAGE_PMD_ORDER));
>>>>                       if (result  != SCAN_SUCCEED) {
>>>>                               last_fail = result;
>>>>                               goto out_nolock;
>>>> --
>>>> 2.50.1
>>>>
>>>
>>
>
> -- 
> Wei Yang
> Help you, Help me


--
Best Regards,
Yan, Zi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ