Re: [PATCH v3 1/9] mm: fix eager write-bit restore for write-notified shared mappings

From: Carlos López

Date: Sun Nov 15 2026 - 17:01:07 EST


On 11/13/26 9:47 PM, Lorenzo Stoakes (ARM) wrote:
>> static inline bool vma_wants_manual_pte_write_upgrade(struct vm_area_struct *vma)
>> {
>> /*
>> @@ -596,19 +604,16 @@ static inline bool vma_wants_manual_pte_write_upgrade(struct vm_area_struct *vma
>> * if we can't do that automatically for all PTEs in a mapping. For
>> * private mappings, that's always the case when we have write
>> * permissions as we properly have to handle COW.
>> + *
>> + * vma->vm_page_prot lacks the write bit if writenotify is already
>> + * enabled, so pass it with the bits restored, as vma_set_page_prot()
>> + * does.
>
> We don't write code in comments.

I'll drop it.

>> */
>> if (vma->vm_flags & VM_SHARED)
>> - return vma_wants_writenotify(vma, vma->vm_page_prot);
>> + return vma_wants_writenotify(vma,
>> + vma_pgprot_modify(vma->vm_page_prot, vma->flags));
>
> You mention vma_set_page_prot() but then implement it differently from there and
> make no effort to abstract it?
>
> And so both callers now do the same thing, and both open code it... you should
> abstract that.

Okay, I'll add a helper for both.