Re: [PATCH v3 04/19] hugetlb_vmemmap: Use try_update_vmemmap_pte to update in-use PTEs

From: Muchun Song

Date: Wed Nov 25 2026 - 04:48:51 EST




> On Nov 25, 2026, at 00:29, James Houghton <jthoughton@xxxxxxxxxx> wrote:
>
> On Mon, Nov 23, 2026 at 9:29 PM Muchun Song <muchun.song@xxxxxxxxx> wrote:
>>
>>>>> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
>>>>> index bc1353f03b08..ab33df268955 100644
>>>>> --- a/include/linux/pgtable.h
>>>>> +++ b/include/linux/pgtable.h
>>>>> @@ -458,6 +458,28 @@ static inline void set_ptes(struct mm_struct *mm, unsigned long addr,
>>>>> #endif
>>>>> #define set_pte_at(mm, addr, ptep, pte) set_ptes(mm, addr, ptep, pte, 1)
>>>>>
>>>>> +#ifdef ARCH_WANTS_GENERIC_POPULATE_VMEMMAP_PTE
>>>>
>>>> Why not ARCH_WANTS_VMEMMAP_UPDATE_PTE? Then x86, loogarch and RISC-V do not need define
>>>> this macro in their ptable.h.
>>>
>>> You're basically asking to make this opt-out instead of opt-in, right?
>>
>> Yes, exactly.
>>
>>>
>>> I like making the different architectures explicitly opt in to the
>>> generic implementation; it forces any new architecture to decide if
>>> the generic implementation is correct for them. But I don't feel
>>> strongly.
>>
>> We already have an opt-in config: ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP.
>> It already forces new architectures to pay attention to it.
>
> Right, but that opt-in is different. Requiring architectures to
> manually specify ARCH_WANTS_GENERIC_POPULATE_VMEMMAP_PTE forces them
> to think about whether or not they need their own population routine.
> But yeah, I guess we can just assume that any new architecture
> implementing HVO should have already checked that. Okay.

Don't worry. I'm planning to rewrite the HVO documentation with a dedicated
chapter that tells architecture guys which hardware features must be supported
and what adaptations are needed when enabling this feature, so there won't be
any issues.

Thanks,
Muchun

>
>>> I'll switch it to opt-out in v4 unless you or someone else tells me otherwise.
>
> So I'll stick with this; I'll switch it to opt-out.
>
> Thanks, Muchun!