RE: [PATCH 4/4] mm/huge_memory: use the large-page PAT encoding for huge pfn mappings
From: Farber, Eliav
Date: Thu Nov 12 2026 - 00:08:12 EST
On 11/11/26 4:54 PM, Jose A. Perez de Azpillaga wrote:
> On 11/11/26 3:06 PM, Eliav Farber wrote:
>> A memtype that needs that bit, write-through or write-protected, loses
>> it: the cache mode index of the huge entry drops from 4-7 to 0-3, so a
>> write-through range is mapped write-back.
>
> here contradicts the cover letter, shouldn't it say the same as the
> cover letter since its the one right?
The cover letter is the correct one, the commit message is wrong.
pat_bp_init() puts WT in PAT slot 7 and WP in slot 5
(arch/x86/mm/pat/memtype.c), so losing the high PAT bit gives 7 -> 3,
which is UC, and 5 -> 1, which is WC. Write-back would need slot 4, which
nothing allocates. v2 says UC and WC.
>> Fixes: 6857be5fecae ("mm: introduce ARCH_SUPPORTS_HUGE_PFNMAP and special bits to pmd/pud")
>
> I think that 5cad465d7fa6 ("mm: add vmf_insert_pfn_pmd()") would fit
> better, IMHO.
Agreed. That commit already called track_pfn_insert() and then built the
entry with pmd_mkhuge(pfn_pmd(pfn, prot)) without converting the pgprot,
so the defect starts there. 6857be5fecae only added the
ARCH_SUPPORTS_HUGE_PFNMAP plumbing. v2 uses 5cad465d7fa6.
--
Thanks,
Eliav