Re: [PATCH 1/1] mm/hugetlb: do not dissolve gigantic pages without runtime support
Longlong Xia <[email protected]>
| Newsgroups | org.kvack.linux-mm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
在 2026/8/19 16:52, David Hildenbrand (Arm) 写道: > On 8/17/26 18:20, Longlong Xia wrote: >> From: Longlong Xia <[email protected]> >> >> 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 > That's odd. Why do they silently skip such folios instead of warning that > something unexpected is happening? > > This screams for a cleanup unless I am missing something :) Because until this patch, dissolve_free_hugetlb_folio() was the one caller that didn't filter hstate_is_gigantic_no_runtime() upstream. A WARN would have fired on a real path: hotplug or hwpoison dissolving a boot gigantic page on a no-runtime arch. So it had to stay silent. This patch guards that last caller. The rest either check hstate_is_gigantic_no_runtime() before calling, or operate on folios that can't be gigantic_no_runtime (surplus/temporary gigantic folios aren't created once alloc_gigantic_frozen_folio() returns NULL). With the gap closed the bail can become a VM_WARN_ON_ONCE: // mm/hugetlb.c:1401 remove_hugetlb_folio if (hstate_is_gigantic_no_runtime(h)) { + /* Callers must filter gigantic_no_runtime upstream. */ + VM_WARN_ON_ONCE(1); return; } // mm/hugetlb.c:1463 __update_and_free_hugetlb_folio if (hstate_is_gigantic_no_runtime(h)) { + /* Callers must filter gigantic_no_runtime upstream. */ + VM_WARN_ON_ONCE(1); return; } Separate follow-up, or fold into a v2 of this patch? Thanks, Longlong