Re: [PATCH v5 7/7] arm64: Add batched versions of ptep_modify_prot_start/commit
From: Catalin Marinas
Date: Mon Jul 21 2025 - 11:58:05 EST
On Fri, Jul 18, 2025 at 02:32:44PM +0530, Dev Jain wrote:
> Override the generic definition of modify_prot_start_ptes() to use
> get_and_clear_full_ptes(). This helper does a TLBI only for the starting
> and ending contpte block of the range, whereas the current implementation
> will call ptep_get_and_clear() for every contpte block, thus doing a
> TLBI on every contpte block. Therefore, we have a performance win.
>
> The arm64 definition of pte_accessible() allows us to batch in the
> errata specific case:
>
> #define pte_accessible(mm, pte) \
> (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid(pte))
>
> All ptes are obviously present in the folio batch, and they are also valid.
>
> Override the generic definition of modify_prot_commit_ptes() to simply
> use set_ptes() to map the new ptes into the pagetable.
>
> Reviewed-by: Ryan Roberts <ryan.roberts@xxxxxxx>
> Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
The arm64 changes look fine to me:
Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx>