Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] mm/hugetlb: do not dissolve gigantic pages without runtime support
@ 2026-08-17 16:20 Longlong Xia
  2026-08-18  3:26 ` Muchun Song
  2026-08-19  8:52 ` David Hildenbrand (Arm)
  0 siblings, 2 replies; 5+ messages in thread
From: Longlong Xia @ 2026-08-17 16:20 UTC (permalink / raw)
  To: muchun.song, osalvador, akpm
  Cc: david, mike.kravetz, mhocko, linmiaohe, linux-mm, linux-kernel,
	Longlong Xia

From: Longlong Xia <xialonglong@kylinos.cn>

dissolve_free_hugetlb_folio() doesn't check hstate_is_gigantic_no_runtime(h)
though remove_hugetlb_folio()/update_and_free_hugetlb_folio() silently
bail for such folios, so it frees a still-listed folio and, on vmemmap
restore failure, the add_hugetlb_folio() rollback corrupts the free
list.

Link: https://sashiko.dev/#/patchset/20260814083027.1419487-1-xialonglong2025@163.com
Fixes: 6eb4e88a6d27 ("hugetlb: create remove_hugetlb_page() to separate functionality")
Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Longlong Xia <xialonglong@kylinos.cn>
---
 mm/hugetlb.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 2239e2566a52..f8370da93647 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1977,6 +1977,15 @@ int dissolve_free_hugetlb_folio(struct folio *folio)
 		struct hstate *h = folio_hstate(folio);
 		bool adjust_surplus = false;
 
+		/*
+		 * remove_hugetlb_folio()/update_and_free_hugetlb_folio() are no-ops
+		 * for gigantic hstates without runtime support, so dissolving one
+		 * here would leave it on the free list and, on vmemmap restore
+		 * failure, the add_hugetlb_folio() rollback corrupts that list.
+		 */
+		if (hstate_is_gigantic_no_runtime(h))
+			goto out;
+
 		if (!available_huge_pages(h))
 			goto out;
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-20  9:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17 16:20 [PATCH 1/1] mm/hugetlb: do not dissolve gigantic pages without runtime support Longlong Xia
2026-08-18  3:26 ` Muchun Song
2026-08-19  8:52 ` David Hildenbrand (Arm)
2026-08-20  7:25   ` Longlong Xia
2026-08-20  9:38   ` Muchun Song

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