]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mm/mmap: leverage vma_rb_erase_ignore() to implement vma_rb_erase()
authorWei Yang <richard.weiyang@linux.alibaba.com>
Tue, 13 Oct 2020 23:53:35 +0000 (16:53 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 14 Oct 2020 01:38:31 +0000 (18:38 -0700)
These two functions share the same logic except ignore a different vma.

Let's reuse the code.

Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Link: https://lkml.kernel.org/r/20200809232057.23477-2-richard.weiyang@linux.alibaba.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mmap.c

index 4815364107efb3b04318d6a2dd5205fcc0434d33..0f3ca5257335aad1b549224363b8d649f4dbace0 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -474,8 +474,12 @@ static __always_inline void vma_rb_erase_ignore(struct vm_area_struct *vma,
 {
        /*
         * 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_ignore(struct vm_area_struct *vma,
 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);
 }
 
 /*