public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
* [PATCH] mm/huge_memory: Fix outdated comment about freeing subpages in __folio_split
@ 2026-04-23  3:49 Barry Song (Xiaomi)
  0 siblings, 0 replies; only message in thread
From: Barry Song (Xiaomi) @ 2026-04-23  3:49 UTC (permalink / raw)
  To: akpm, linux-mm
  Cc: linux-kernel, Barry Song (Xiaomi), David Hildenbrand,
	Lorenzo Stoakes, Zi Yan, Baolin Wang, Liam R. Howlett, Nico Pache,
	Ryan Roberts, Dev Jain, Lance Yang, Chris Li, Kairui Song,
	Kemeng Shi, Nhat Pham, Baoquan He, Youngjun Park

The comment appears to be outdated. First, add_to_swap() no longer
exists after Kairui’s commit b487a2da3575 ("mm, swap: simplify folio
swap allocation"). Second, partially zapped folios are now always
split before folio_alloc_swap() to avoid extra I/O, following Ryan’s
commit 5ed890ce5147 ("mm: vmscan: avoid split during
shrink_folio_list()").
Fix this by making the description more generic.

Cc: David Hildenbrand <david@kernel.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: Nico Pache <npache@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Chris Li <chrisl@kernel.org>
Cc: Kairui Song <kasong@tencent.com>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Youngjun Park <youngjun.park@lge.com>
Signed-off-by: Barry Song (Xiaomi) <baohua@kernel.org>
---
 mm/huge_memory.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 970e077019b7..4586f3ccb133 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -4190,11 +4190,10 @@ static int __folio_split(struct folio *folio, unsigned int new_order,
 
 		folio_unlock(new_folio);
 		/*
-		 * Subpages may be freed if there wasn't any mapping
-		 * like if add_to_swap() is running on a lru page that
-		 * had its mapping zapped. And freeing these pages
-		 * requires taking the lru_lock so we do the put_page
-		 * of the tail pages after the split is complete.
+		 * Subpages whose mapping has been zapped may be freed
+		 * earlier, but freeing them requires taking the
+		 * lru_lock, so we defer put_page() on tail pages until
+		 * after the split completes.
 		 */
 		free_folio_and_swap_cache(new_folio);
 	}
-- 
2.39.3 (Apple Git-146)



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-23  3:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23  3:49 [PATCH] mm/huge_memory: Fix outdated comment about freeing subpages in __folio_split Barry Song (Xiaomi)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox