[PATCH 6/8] mm/memory: use set_softleaf_ptes for uffd-wp markers

From: Dev Jain

Date: Thu Jul 23 2026 - 03:11:11 EST


Use set_softleaf_ptes() to store multiple uffd-wp marker entries instead
of open coding the batched setting.

Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
---
mm/memory.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 7a8442fda0b51..390ea3aefbccb 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1733,14 +1733,8 @@ bool cond_install_uffd_wp_ptes(struct vm_area_struct *vma,
if (likely(!arm_uffd_pte))
return false;

- for (;;) {
- set_pte_at(vma->vm_mm, addr, ptep,
- make_pte_marker(PTE_MARKER_UFFD_WP));
- if (--nr_ptes == 0)
- break;
- ptep++;
- addr += PAGE_SIZE;
- }
+ set_softleaf_ptes(vma->vm_mm, addr, ptep,
+ make_pte_marker(PTE_MARKER_UFFD_WP), nr_ptes);

return true;
}
--
2.43.0