Re: [PATCH 7/8] mm/khugepaged: clarify a comment regarding max_ptes_none check
From: Usama Arif
Date: Mon Jul 06 2026 - 15:36:17 EST
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?
*/
> if (enabled_orders != BIT(HPAGE_PMD_ORDER))
> ctx.max_ptes_none = KHUGEPAGED_MAX_PTES_LIMIT;
> --
> 2.54.0
>
>