The patch titled Subject: mm/mmap: leverage vma_rb_erase_ignore() to implement vma_rb_erase() has been added to the -mm tree. Its filename is mm-mmap-leverage-vma_rb_erase_ignore-to-implement-vma_rb_erase.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-mmap-leverage-vma_rb_erase_ignore-to-implement-vma_rb_erase.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-mmap-leverage-vma_rb_erase_ignore-to-implement-vma_rb_erase.patch 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 and is updated there every 3-4 working days ------------------------------------------------------ From: Wei Yang <richard.weiyang@xxxxxxxxxxxxxxxxx> Subject: mm/mmap: leverage vma_rb_erase_ignore() to implement vma_rb_erase() These two functions share the same logic except ignore a different vma. Let's reuse the code. Link: https://lkml.kernel.org/r/20200809232057.23477-2-richard.weiyang@xxxxxxxxxxxxxxxxx Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/mmap.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) --- a/mm/mmap.c~mm-mmap-leverage-vma_rb_erase_ignore-to-implement-vma_rb_erase +++ a/mm/mmap.c @@ -474,8 +474,12 @@ static __always_inline void vma_rb_erase { /* * All rb_subtree_gap values must be consistent prior to erase, - * with the possible exception of the "next" vma being erased if - * next->vm_start was reduced. + * with the possible exception of + * + * a. the "next" vma being erased if next->vm_start was reduced in + * __vma_adjust() -> __vma_unlink() + * b. the vma being erased in detach_vmas_to_be_unmapped() -> + * vma_rb_erase() */ validate_mm_rb(root, ignore); @@ -485,13 +489,7 @@ static __always_inline void vma_rb_erase static __always_inline void vma_rb_erase(struct vm_area_struct *vma, struct rb_root *root) { - /* - * All rb_subtree_gap values must be consistent prior to erase, - * with the possible exception of the vma being erased. - */ - validate_mm_rb(root, vma); - - __vma_rb_erase(vma, root); + vma_rb_erase_ignore(vma, root, vma); } /* _ Patches currently in -mm which might be from richard.weiyang@xxxxxxxxxxxxxxxxx are mm-mmap-rename-__vma_unlink_common-to-__vma_unlink.patch mm-mmap-leverage-vma_rb_erase_ignore-to-implement-vma_rb_erase.patch mm-page_reporting-drop-stale-list-head-check-in-page_reporting_cycle.patch