[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221129164352.3374638-22-Liam.Howlett@oracle.com>
Date: Tue, 29 Nov 2022 16:44:29 +0000
From: Liam Howlett <liam.howlett@...cle.com>
To: "maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
CC: Liam Howlett <liam.howlett@...cle.com>,
Liam Howlett <liam.howlett@...cle.com>
Subject: [PATCH 21/43] madvise: Use vmi iterator for __split_vma() and
vma_merge()
From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
Use the vma iterator so that the iterator can be invalidated or updated
to avoid each caller doing so.
Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
---
mm/madvise.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mm/madvise.c b/mm/madvise.c
index c7105ec6d08c..2beced2d5eee 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -145,6 +145,7 @@ static int madvise_update_vma(struct vm_area_struct *vma,
struct mm_struct *mm = vma->vm_mm;
int error;
pgoff_t pgoff;
+ VMA_ITERATOR(vmi, mm, 0);
if (new_flags == vma->vm_flags && anon_vma_name_eq(anon_vma_name(vma), anon_name)) {
*prev = vma;
@@ -152,8 +153,8 @@ static int madvise_update_vma(struct vm_area_struct *vma,
}
pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT);
- *prev = vma_merge(mm, *prev, start, end, new_flags, vma->anon_vma,
- vma->vm_file, pgoff, vma_policy(vma),
+ *prev = vmi_vma_merge(&vmi, mm, *prev, start, end, new_flags,
+ vma->anon_vma, vma->vm_file, pgoff, vma_policy(vma),
vma->vm_userfaultfd_ctx, anon_name);
if (*prev) {
vma = *prev;
@@ -165,7 +166,7 @@ static int madvise_update_vma(struct vm_area_struct *vma,
if (start != vma->vm_start) {
if (unlikely(mm->map_count >= sysctl_max_map_count))
return -ENOMEM;
- error = __split_vma(mm, vma, start, 1);
+ error = vmi__split_vma(&vmi, mm, vma, start, 1);
if (error)
return error;
}
@@ -173,7 +174,7 @@ static int madvise_update_vma(struct vm_area_struct *vma,
if (end != vma->vm_end) {
if (unlikely(mm->map_count >= sysctl_max_map_count))
return -ENOMEM;
- error = __split_vma(mm, vma, end, 0);
+ error = vmi__split_vma(&vmi, mm, vma, end, 0);
if (error)
return error;
}
--
2.35.1
Powered by blists - more mailing lists