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

David Hildenbrand (Arm)
2026-03-12T15:57:29Z

On 3/12/26 16:53, David Hildenbrand (Arm) wrote:
> On 3/10/26 04:11, WANG Rui wrote:
>> 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;
>
> There are other ways to enable PMD THP. So I don't quite think this is
> the right tool for the job.

Ah, you care about file THPs ... gah.

Why can't we simply do the alignment without considering the current
setting?

--
Cheers,

David