[PATCH 60/94] drivers/misc/cxl: Use maple tree iterators for cxl_prefault_vma()

From: Liam Howlett
Date: Wed Apr 28 2021 - 11:40:15 EST


Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
---
drivers/misc/cxl/fault.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c
index 60c829113299..60a33b953ef4 100644
--- a/drivers/misc/cxl/fault.c
+++ b/drivers/misc/cxl/fault.c
@@ -313,6 +313,7 @@ static void cxl_prefault_vma(struct cxl_context *ctx)
struct vm_area_struct *vma;
int rc;
struct mm_struct *mm;
+ MA_STATE(mas, NULL, 0, 0);

mm = get_mem_context(ctx);
if (mm == NULL) {
@@ -321,8 +322,10 @@ static void cxl_prefault_vma(struct cxl_context *ctx)
return;
}

+ mas.tree = &mm->mm_mt;
mmap_read_lock(mm);
- for (vma = mm->mmap; vma; vma = vma->vm_next) {
+ rcu_read_lock();
+ mas_for_each(&mas, vma, ULONG_MAX) {
for (ea = vma->vm_start; ea < vma->vm_end;
ea = next_segment(ea, slb.vsid)) {
rc = copro_calculate_slb(mm, ea, &slb);
@@ -336,6 +339,7 @@ static void cxl_prefault_vma(struct cxl_context *ctx)
last_esid = slb.esid;
}
}
+ rcu_read_unlock();
mmap_read_unlock(mm);

mmput(mm);
--
2.30.2