[PATCH v2 2/2] mm/hugetlb: warn instead of silently bailing gigantic pages without runtime support
From: Longlong Xia
Date: Sun Aug 23 2026 - 00:42:48 EST
From: Longlong Xia <xialonglong@xxxxxxxxxx>
remove_hugetlb_folio() and __update_and_free_hugetlb_folio() silently
return for gigantic hstates that lack runtime freeing support. All
callers should already filter such hstates upstream, so turn the
silent bail into a VM_WARN_ON_ONCE to catch caller regressions
instead of masking them.
Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Longlong Xia <xialonglong@xxxxxxxxxx>
---
mm/hugetlb.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 8b9cb476a41b..67a502293698 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1398,8 +1398,11 @@ void remove_hugetlb_folio(struct hstate *h, struct folio *folio,
VM_BUG_ON_FOLIO(hugetlb_cgroup_from_folio_rsvd(folio), folio);
lockdep_assert_held(&hugetlb_lock);
- if (hstate_is_gigantic_no_runtime(h))
+ if (hstate_is_gigantic_no_runtime(h)) {
+ /* Callers must filter gigantic_no_runtime upstream. */
+ VM_WARN_ON_ONCE(1);
return;
+ }
list_del(&folio->lru);
@@ -1460,8 +1463,11 @@ static void __update_and_free_hugetlb_folio(struct hstate *h,
{
bool clear_flag = folio_test_hugetlb_vmemmap_optimized(folio);
- if (hstate_is_gigantic_no_runtime(h))
+ if (hstate_is_gigantic_no_runtime(h)) {
+ /* Callers must filter gigantic_no_runtime upstream. */
+ VM_WARN_ON_ONCE(1);
return;
+ }
/*
* If we don't know which subpages are hwpoisoned, we can't free
--
2.43.0