[PATCH v4 1/2] huge_mm: add stubs for THP-disabled configs

WANG Rui
2026-03-10T03:12:40Z

hugepage_global_enabled() and hugepage_global_always() only exist
when CONFIG_TRANSPARENT_HUGEPAGE is set. Add inline stubs that
return false to let code compile when THP is disabled.

Signed-off-by: WANG Rui <r@hev.cc>
---
include/linux/huge_mm.h | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index a4d9f964dfde..badeebd4ea98 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -570,6 +570,16 @@ void map_anon_folio_pmd_nopf(struct folio *folio, pmd_t *pmd,

#else /* CONFIG_TRANSPARENT_HUGEPAGE */

+static inline bool hugepage_global_enabled(void)
+{
+ return false;
+}
+
+static inline bool hugepage_global_always(void)
+{
+ return false;
+}
+
static inline bool folio_test_pmd_mappable(struct folio *folio)
{
return false;
--
2.53.0