summaryrefslogtreecommitdiff
path: root/mm/madvise.c
diff options
context:
space:
mode:
authorLiam R. Howlett <Liam.Howlett@Oracle.com>2023-01-20 19:26:34 +0300
committerAndrew Morton <akpm@linux-foundation.org>2023-02-10 03:51:36 +0300
commit85ab779e3426dc47cc27418821e6577680b509b9 (patch)
tree7bed88f3827e5a6ca313d49271feeda3d4d00332 /mm/madvise.c
parent9e56044625a1f472edc278105f41a60726991d89 (diff)
downloadlinux-85ab779e3426dc47cc27418821e6577680b509b9.tar.xz
madvise: use split_vma() instead of __split_vma()
The split_vma() wrapper is specifically for this use case, so use it. [Liam.Howlett@oracle.com: fix VMA_ITERATOR start position] Link: https://lkml.kernel.org/r/20230125135809.85262-1-Liam.Howlett@oracle.com Link: https://lkml.kernel.org/r/20230120162650.984577-34-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/madvise.c')
-rw-r--r--mm/madvise.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/mm/madvise.c b/mm/madvise.c
index 02b317726c9a..ca672e37b38c 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -142,7 +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);
+ VMA_ITERATOR(vmi, mm, start);
if (new_flags == vma->vm_flags && anon_vma_name_eq(anon_vma_name(vma), anon_name)) {
*prev = vma;
@@ -161,17 +161,13 @@ static int madvise_update_vma(struct vm_area_struct *vma,
*prev = vma;
if (start != vma->vm_start) {
- if (unlikely(mm->map_count >= sysctl_max_map_count))
- return -ENOMEM;
- error = __split_vma(&vmi, vma, start, 1);
+ error = split_vma(&vmi, vma, start, 1);
if (error)
return error;
}
if (end != vma->vm_end) {
- if (unlikely(mm->map_count >= sysctl_max_map_count))
- return -ENOMEM;
- error = __split_vma(&vmi, vma, end, 0);
+ error = split_vma(&vmi, vma, end, 0);
if (error)
return error;
}