[PATCH 27/28] mmap: Update count_vma_pages_range() to only use one ma_state

From: Liam R. Howlett
Date: Thu Dec 10 2020 - 13:17:07 EST


Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
---
mm/mmap.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 284c90504b44c..7a575e6f1e7df 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -483,17 +483,15 @@ static unsigned long count_vma_pages_range(struct mm_struct *mm,
MA_STATE(mas, &mm->mm_mt, addr, addr);

/* Find first overlaping mapping */
- vma = find_vma_intersection(mm, addr, end);
+ vma = mas_find(&mas, end - 1);
if (!vma)
return 0;

vm_start = vma->vm_start;
vm_end = vma->vm_end;
-
nr_pages = (min(end, vm_end) - max(addr, vm_start)) >> PAGE_SHIFT;

/* Iterate over the rest of the overlaps */
- mas.index = mas.last = vm_end;
mas_for_each(&mas, vma, end) {
vm_start = vma->vm_start;
vm_end = vma->vm_end;
--
2.28.0