On Thu, Aug 21, 2025 at 10:09:10AM -0400, Zi Yan wrote: > 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).
Thanks yeah that makes sense, so let's keep it all as HPAGE_PMD_ORDER then! Cheers, Lorenzo