Re: [PATCH 7/8] mm/khugepaged: clarify a comment regarding max_ptes_none check
From: Nico Pache
Date: Mon Jul 13 2026 - 09:58:05 EST
On Mon, Jul 6, 2026 at 1:36 PM Usama Arif <usama.arif@xxxxxxxxx> wrote:
>
> On Mon, 6 Jul 2026 09:44:54 -0600 Nico Pache <npache@xxxxxxxxxx> wrote:
>
> > While reading collapse_scan_pmd, one may be confused on where the deferred
> > max_ptes_none check is done. Expand on this current comment by explaining
> > which function the max_ptes_none check is now done.
> >
> > Suggested-by: David Hildenbrand <david@xxxxxxxxxx>
> > Signed-off-by: Nico Pache <npache@xxxxxxxxxx>
> > ---
> > mm/khugepaged.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> > index 3c6f1254deca..388045a524a3 100644
> > --- a/mm/khugepaged.c
> > +++ b/mm/khugepaged.c
> > @@ -1728,7 +1728,8 @@ static enum scan_result collapse_scan_pmd(struct mm_struct *mm,
> >
> > /*
> > * If PMD is the only enabled order, enforce max_ptes_none, otherwise
> > - * scan all pages to populate the bitmap for mTHP collapse.
> > + * scan all pages to populate the bitmap for mTHP collapse. The bitmap
> > + * is then checked again in mthp_collapse() for each attempted order.
>
> Could be combined with patch 4?
Yeah, sure :)
Thanks
-- Nico
>
> */
> > if (enabled_orders != BIT(HPAGE_PMD_ORDER))
> > ctx.max_ptes_none = KHUGEPAGED_MAX_PTES_LIMIT;
> > --
> > 2.54.0
> >
> >
>