mirror of
https://github.com/torvalds/linux.git
synced 2024-12-24 11:51:27 +00:00
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;
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user