Re: [PATCH v2 3/5] mm/huge_memory: add page->private check back in __split_folio_to_order()

From: Vlastimil Babka (SUSE)

Date: Thu Jul 09 2026 - 04:03:22 EST


On 7/3/26 15:47, Zi Yan wrote:
> page->private should not be set in tail pages. Commit 4265d67e405a
> ("mm/migrate_device: add THP splitting during migration") removed it

I would say e.g. "a DEBUG_VM check" instead of "it"

> without a proper reason[1]. Add it back.
>
> Link: https://lore.kernel.org/all/13f3fcda-7328-4aa5-afc6-75a294a82b2a@xxxxxxxxxx/ [1]
> Reviewed-by: Lance Yang <lance.yang@xxxxxxxxx>
> Signed-off-by: Zi Yan <ziy@xxxxxxxxxx>

Reviewed-by: Vlastimil Babka (SUSE) <vbabka@xxxxxxxxxx>

> ---
> mm/huge_memory.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index bdd8635922f96..06d0671cff899 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -3591,6 +3591,13 @@ static void __split_folio_to_order(struct folio *folio, int old_order,
> new_folio->mapping = folio->mapping;
> new_folio->index = folio->index + i;
>
> + /*
> + * page->private should not be set in tail pages. Warn once
> + * if private is unexpectedly set. Do it before swap.val assignment
> + * since private overlaps with swap.val.
> + */
> + VM_WARN_ON_ONCE_PAGE(new_folio->private, new_head);
> +
> if (folio_test_swapcache(folio))
> new_folio->swap.val = folio->swap.val + i;
>
>