On 08/06/2025 08:35, Yafang Shao wrote: > The order has already been validated in hugepage_pmd_enabled(), so there's > no need to recheck it in thp_vma_allowable_orders(). > The checks are not equivalent. hugepage_pmd_enabled just checks if the sysfs entries allow hugification. thp_vma_allowable_orders modifies the orders that can be used based on vm_flags, which is not done in hugepage_pmd_enabled. > Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx> > --- > mm/khugepaged.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > index 15203ea7d007..79e208999ddb 100644 > --- a/mm/khugepaged.c > +++ b/mm/khugepaged.c > @@ -474,8 +474,8 @@ void khugepaged_enter_vma(struct vm_area_struct *vma, > { > if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags) && > hugepage_pmd_enabled()) { > - if (thp_vma_allowable_order(vma, vm_flags, TVA_ENFORCE_SYSFS, > - PMD_ORDER)) > + if (__thp_vma_allowable_orders(vma, vm_flags, TVA_ENFORCE_SYSFS, > + BIT(PMD_ORDER))) > __khugepaged_enter(vma->vm_mm); > } > }