summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLiam R. Howlett <Liam.Howlett@Oracle.com>2023-01-20 17:26:24 +0100
committerAndrew Morton <akpm@linux-foundation.org>2023-02-10 01:51:34 +0100
commit178e22ac2078b1a7d284c7e3b4c3fbdb8e85ae99 (patch)
tree0bf3a521431d8ed426eb860971388ba9f695eea0 /mm
parentsched: convert to vma iterator (diff)
downloadlinux-178e22ac2078b1a7d284c7e3b4c3fbdb8e85ae99.tar.xz
linux-178e22ac2078b1a7d284c7e3b4c3fbdb8e85ae99.zip
madvise: use vmi iterator for __split_vma() and vma_merge()
Use the vma iterator so that the iterator can be invalidated or updated to avoid each caller doing so. Link: https://lkml.kernel.org/r/20230120162650.984577-24-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/madvise.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/mm/madvise.c b/mm/madvise.c
index 92a3c6bd84c1..4d4471916465 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -142,6 +142,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;
@@ -149,8 +150,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;
@@ -162,7 +163,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;
}
@@ -170,7 +171,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;
}