Re: [PATCH v2 2/3] mm/memory: batch set uffd-wp markers during zapping

From: David Hildenbrand (Arm)

Date: Mon Jul 20 2026 - 04:22:06 EST


On 7/20/26 07:55, Dev Jain wrote:
> Enable batch setting of uffd-wp PTE markers.
>
> The code paths passing nr > 1 to zap_install_uffd_wp_if_needed() produce
> that nr through either folio_pte_batch() or swap_pte_batch(), therefore
> batching is correct:
>
> 1) All PTEs belong to the same type of VMA: anonymous or non-anonymous,
> wp-armed or non-wp-armed.
>
> 2) All PTEs are either marked with uffd-wp or not marked with uffd-wp;
> the same applies to the pte_swp_uffd_any() check.
>
> 3) uffd_supports_wp_marker() is independent of the function parameters.
>
> Use set_pte_at() in a loop instead of set_ptes(), because set_ptes()
> cannot handle nonpresent to nonpresent conversion for nr_pages > 1.
>
> Rename the helper to cond_install_uffd_wp_ptes().
>
> Signed-off-by: Dev Jain <dev.jain@xxxxxxx>

Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

--
Cheers,

David