Commit 183b7a60 authored by Vlastimil Babka's avatar Vlastimil Babka Committed by Andrew Morton

mm/mmap/vma_merge: use the proper vma pointer in case 4

Almost all cases now use the 'next' pointer for the vma following the
merged area, and the cases diagram shows it as XXXX.  Case 4 is different
as it uses 'mid' and NNNN, so change it for consistency.  No functional
change.

Link: https://lkml.kernel.org/r/20230309111258.24079-5-vbabka@suse.czSigned-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
Reviewed-by: default avatarLorenzo Stoakes <lstoakes@gmail.com>
Reviewed-by: default avatarLiam R. Howlett <Liam.Howlett@oracle.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 5ff783f1
...@@ -851,9 +851,9 @@ can_vma_merge_after(struct vm_area_struct *vma, unsigned long vm_flags, ...@@ -851,9 +851,9 @@ can_vma_merge_after(struct vm_area_struct *vma, unsigned long vm_flags,
* vma, PPPPPP is the prev vma specified, and NNNNNN the next vma after: * vma, PPPPPP is the prev vma specified, and NNNNNN the next vma after:
* *
* AAAA AAAA AAAA * AAAA AAAA AAAA
* PPPPPPNNNNNN PPPPPPNNNNNN PPPPPPNNNNNN * PPPPPPNNNNNN PPPPPPXXXXXX PPPPPPNNNNNN
* cannot merge might become might become * cannot merge might become might become
* PPNNNNNNNNNN PPPPPPPPPPNN * PPXXXXXXXXXX PPPPPPPPPPNN
* mmap, brk or case 4 below case 5 below * mmap, brk or case 4 below case 5 below
* mremap move: * mremap move:
* AAAA AAAA * AAAA AAAA
...@@ -972,9 +972,9 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm, ...@@ -972,9 +972,9 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm,
res = next; res = next;
if (prev && addr < prev->vm_end) { /* case 4 */ if (prev && addr < prev->vm_end) { /* case 4 */
vma_end = addr; vma_end = addr;
adjust = mid; adjust = next;
adj_next = -(prev->vm_end - addr); adj_next = -(prev->vm_end - addr);
err = dup_anon_vma(mid, prev); err = dup_anon_vma(next, prev);
} else { } else {
vma = next; /* case 3 */ vma = next; /* case 3 */
vma_start = addr; vma_start = addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment