On 2025-11-17 12:49, David Hildenbrand (Red Hat) wrote:
> On 06.11.25 22:28, Luiz Capitulino wrote:
>> Historically, THP support on x86 checked the PSE feature bit to enable
>> THP. On 64-bit, this check is redundant since PSE is always enabled by
>> default for compatibility. On 32-bit, PSE enables 4MB page support and
>
> Or 2MB support with 4byte PTEs I guess?
>
>> must be checked. To clean this up, this commit:
>>
>
> Likely the subject should start with: "x86/mm:"
You're right on both points. I'll fix the changelog for the next
version.
>
>
>> 1. Drops arch_has_pmd_leaves() from common x86 code. For 64-bit,
>> we assume PMD-sized pages are always supported
>>
>> 2. Checks for PSE only on 32-bit, using arch_has_pmd_leaves()
>>
>> Signed-off-by: Luiz Capitulino <luizcap@redhat.com>
>> ---
>> arch/x86/include/asm/pgtable.h | 6 ------
>> arch/x86/include/asm/pgtable_32.h | 6 ++++++
>> 2 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
>> index 08d109280e36..55b88de5178f 100644
>> --- a/arch/x86/include/asm/pgtable.h
>> +++ b/arch/x86/include/asm/pgtable.h
>> @@ -313,12 +313,6 @@ static inline int pud_trans_huge(pud_t pud)
>> }
>> #endif
>> -#define arch_has_pmd_leaves arch_has_pmd_leaves
>> -static inline int arch_has_pmd_leaves(void)
>> -{
>> - return boot_cpu_has(X86_FEATURE_PSE);
>> -}
>> -
>> #ifdef CONFIG_ARCH_SUPPORTS_PMD_PFNMAP
>> static inline bool pmd_special(pmd_t pmd)
>> {
>> diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
>> index b612cc57a4d3..3bd51cfa431e 100644
>> --- a/arch/x86/include/asm/pgtable_32.h
>> +++ b/arch/x86/include/asm/pgtable_32.h
>> @@ -45,6 +45,12 @@ do { \
>> flush_tlb_one_kernel((vaddr)); \
>> } while (0)
>> +#define arch_has_pmd_leaves arch_has_pmd_leaves
>> +static inline int arch_has_pmd_leaves(void)
>> +{
>> + return boot_cpu_has(X86_FEATURE_PSE);
>> +}
>> +
>> #endif /* !__ASSEMBLER__ */
>> /*
>
> Right, IIUC 64bit should neve rrequire this check.
>