[PATCH v3 7/9] mm/memory: use set_softleaf_ptes for uffd-wp markers

From: Dev Jain

Date: Thu Sep 24 2026 - 09:14:50 EST


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

Reviewed-by: Barry Song <baohua@xxxxxxxxxx>
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 60fd0a08b35f5..bed5cd90356f4 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1700,14 +1700,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