[PATCH v1 10/11] mm/huge_memory: add page->private check back in __split_folio_to_order()
Zi Yan
ziy at nvidia.com
Mon Feb 23 14:26:40 AEDT 2026
page->private should not be set in tail pages. Commit 4265d67e405a
("mm/migrate_device: add THP splitting during migration") removed it
without a proper reason. Add it back.
Signed-off-by: Zi Yan <ziy at nvidia.com>
Cc: David Hildenbrand <david at kernel.org>
Cc: Lorenzo Stoakes <lorenzo.stoakes at oracle.com>
Cc: Baolin Wang <baolin.wang at linux.alibaba.com>
Cc: "Liam R. Howlett" <Liam.Howlett at oracle.com>
Cc: Nico Pache <npache at redhat.com>
Cc: Ryan Roberts <ryan.roberts at arm.com>
Cc: Dev Jain <dev.jain at arm.com>
Cc: Barry Song <baohua at kernel.org>
Cc: Lance Yang <lance.yang at linux.dev>
Cc: linux-mm at kvack.org
---
mm/huge_memory.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 27316d741927..6b57d219fc97 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3548,6 +3548,16 @@ 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. Fix up and warn once
+ * if private is unexpectedly set. Do it before swap.val assignment
+ * since private overlaps with swap.val.
+ */
+ if (unlikely(new_folio->private)) {
+ VM_WARN_ON_ONCE_PAGE(true, new_head);
+ new_folio->private = NULL;
+ }
+
if (folio_test_swapcache(folio))
new_folio->swap.val = folio->swap.val + i;
--
2.51.0
More information about the Linux-erofs
mailing list