The patch titled Subject: mm/mmap: Add case 9 in vma_merge() has been added to the -mm mm-unstable branch. Its filename is mm-mmap-add-case-9-in-vma_merge.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mmap-add-case-9-in-vma_merge.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Yajun Deng <yajun.deng@xxxxxxxxx> Subject: mm/mmap: Add case 9 in vma_merge() Date: Sun, 18 Feb 2024 16:50:28 +0800 If the prev vma exists and the end is less than the end of prev, we can return NULL immediately. This reduces unnecessary operations. Link: https://lkml.kernel.org/r/20240218085028.3294332-1-yajun.deng@xxxxxxxxx Signed-off-by: Yajun Deng <yajun.deng@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/mmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/mm/mmap.c~mm-mmap-add-case-9-in-vma_merge +++ a/mm/mmap.c @@ -827,7 +827,7 @@ can_vma_merge_after(struct vm_area_struc * * **** **** **** * PPPPPPNNNNNN PPPPPPNNNNNN PPPPPPCCCCCC - * cannot merge might become might become + * cannot merge 9 might become might become * PPNNNNNNNNNN PPPPPPPPPPCC * mmap, brk or case 4 below case 5 below * mremap move: @@ -890,6 +890,9 @@ static struct vm_area_struct if (vm_flags & VM_SPECIAL) return NULL; + if (prev && end < prev->vm_end) /* case 9 */ + return NULL; + /* Does the input range span an existing VMA? (cases 5 - 8) */ curr = find_vma_intersection(mm, prev ? prev->vm_end : 0, end); _ Patches currently in -mm which might be from yajun.deng@xxxxxxxxx are mm-mmap-simplify-vma-link-and-unlink.patch mm-mmap-introduce-vma_set_range.patch mm-mmap-use-sz_8k-128k-helper-macro.patch mm-mmap-pass-vma-to-vma_merge.patch mm-mmap-add-case-9-in-vma_merge.patch