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>
This commit is contained in:
parent
9e56044625
commit
85ab779e34
10
mm/madvise.c
10
mm/madvise.c
@ -142,7 +142,7 @@ static int madvise_update_vma(struct vm_area_struct *vma,
|
|||||||
struct mm_struct *mm = vma->vm_mm;
|
struct mm_struct *mm = vma->vm_mm;
|
||||||
int error;
|
int error;
|
||||||
pgoff_t pgoff;
|
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)) {
|
if (new_flags == vma->vm_flags && anon_vma_name_eq(anon_vma_name(vma), anon_name)) {
|
||||||
*prev = vma;
|
*prev = vma;
|
||||||
@ -161,17 +161,13 @@ static int madvise_update_vma(struct vm_area_struct *vma,
|
|||||||
*prev = vma;
|
*prev = vma;
|
||||||
|
|
||||||
if (start != vma->vm_start) {
|
if (start != vma->vm_start) {
|
||||||
if (unlikely(mm->map_count >= sysctl_max_map_count))
|
error = split_vma(&vmi, vma, start, 1);
|
||||||
return -ENOMEM;
|
|
||||||
error = __split_vma(&vmi, vma, start, 1);
|
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end != vma->vm_end) {
|
if (end != vma->vm_end) {
|
||||||
if (unlikely(mm->map_count >= sysctl_max_map_count))
|
error = split_vma(&vmi, vma, end, 0);
|
||||||
return -ENOMEM;
|
|
||||||
error = __split_vma(&vmi, vma, end, 0);
|
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user