[PATCH 2/8] mm/huge_memory: use folio_swap_entry() when splitting a swapcache folio

From: Tal Zussman

Date: Sun Aug 30 2026 - 06:33:52 EST


__split_folio_to_order() open-codes the swap entry computation for the
split-out folios. Use folio_swap_entry() instead.

No functional change.

Signed-off-by: Tal Zussman <tz2294@xxxxxxxxxxxx>
---
mm/huge_memory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 54494c3fa983..03287f995d92 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3760,7 +3760,7 @@ static void __split_folio_to_order(struct folio *folio, int old_order,
VM_WARN_ON_ONCE_PAGE(new_folio->private, new_head);

if (folio_test_swapcache(folio))
- new_folio->swap.val = folio->swap.val + i;
+ new_folio->swap = folio_swap_entry(folio, i);

/* Page flags must be visible before we make the page non-compound. */
smp_wmb();

--
2.39.5