]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/util: Remove __vma_link_list() and __vma_unlink_list()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 4 Jan 2021 20:10:54 +0000 (15:10 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 19 May 2021 20:39:09 +0000 (16:39 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mm/internal.h
mm/mmap.c
mm/nommu.c
mm/util.c

index 87adaa0893cd206a4549cb0e7692f9e1f08b0331..8d414d009882d742d04b600974c3afcc954fed18 100644 (file)
@@ -396,11 +396,6 @@ static inline int vma_mas_remove(struct vm_area_struct *vma, struct ma_state *ma
        return ret;
 }
 
-/* mm/util.c */
-void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
-               struct vm_area_struct *prev);
-void __vma_unlink_list(struct mm_struct *mm, struct vm_area_struct *vma);
-
 #ifdef CONFIG_MMU
 extern long populate_vma_page_range(struct vm_area_struct *vma,
                unsigned long start, unsigned long end, int *nonblocking);
index 8b0901d503b38175248740055b8b83ce82d54d2a..80dd47cfeac125c432defba346998405ee02c5d4 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -585,7 +585,6 @@ static void vma_mas_link(struct mm_struct *mm, struct vm_area_struct *vma,
        }
 
        vma_mas_store(vma, mas);
-       __vma_link_list(mm, vma, prev);
        __vma_link_file(vma);
 
        if (mapping)
@@ -606,7 +605,6 @@ static void vma_link(struct mm_struct *mm, struct vm_area_struct *vma,
        }
 
        vma_mt_store(mm, vma);
-       __vma_link_list(mm, vma, prev);
        __vma_link_file(vma);
 
        if (mapping)
@@ -626,7 +624,6 @@ static void __insert_vm_struct(struct mm_struct *mm, struct vm_area_struct *vma)
 
        BUG_ON(range_has_overlap(mm, vma->vm_start, vma->vm_end, &prev));
        vma_mt_store(mm, vma);
-       __vma_link_list(mm, vma, prev);
        mm->map_count++;
 }
 
@@ -683,13 +680,8 @@ inline int vma_expand(struct ma_state *mas, struct vm_area_struct *vma,
        }
 
        /* Expanding over the next vma */
-       if (remove_next) {
-               /* Remove from mm linked list - also updates highest_vm_end */
-               __vma_unlink_list(mm, next);
-
-               if (file)
-                       __remove_shared_vm_struct(next, file, mapping);
-
+       if (remove_next && file) {
+               __remove_shared_vm_struct(next, file, mapping);
        } else if (!next) {
                mm->highest_vm_end = vm_end_gap(vma);
        }
@@ -898,10 +890,8 @@ again:
                flush_dcache_mmap_unlock(mapping);
        }
 
-       if (remove_next) {
-               __vma_unlink_list(mm, next);
-               if (file)
-                       __remove_shared_vm_struct(next, file, mapping);
+       if (remove_next && file) {
+               __remove_shared_vm_struct(next, file, mapping);
        } else if (insert) {
                /*
                 * split_vma has split insert from vma, and needs
@@ -3125,7 +3115,6 @@ static int do_brk_flags(struct ma_state *mas, struct vm_area_struct **brkvma,
        if (!prev)
                prev = mas_prev(mas, 0);
 
-       __vma_link_list(mm, vma, prev);
        mm->map_count++;
        *brkvma = vma;
 out:
index 0eea24df1bd58472c6f992d86ff7d02ad9189ecb..916038bafc65c63f62dd3885b60632fdb89d0d56 100644 (file)
@@ -592,7 +592,6 @@ static void add_vma_to_mm(struct mm_struct *mm, struct vm_area_struct *vma)
        mas_reset(&mas);
        /* add the VMA to the tree */
        vma_mas_store(vma, &mas);
-       __vma_link_list(mm, vma, prev);
 }
 
 /*
@@ -617,7 +616,6 @@ static void delete_vma_from_mm(struct vm_area_struct *vma)
 
        /* remove from the MM's tree and list */
        vma_mas_remove(vma, &mas);
-       __vma_unlink_list(vma->vm_mm, vma);
 }
 
 /*
@@ -1430,7 +1428,7 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len, struct list
                                return -EINVAL;
                        if (end == vma->vm_end)
                                goto erase_whole_vma;
-                       vma = vma->vm_next;
+                       vma =  vma_next(mm, vma);
                } while (vma);
                return -EINVAL;
        } else {
@@ -1488,7 +1486,7 @@ void exit_mmap(struct mm_struct *mm)
        mm->total_vm = 0;
 
        while ((vma = mm->mmap)) {
-               mm->mmap = vma->vm_next;
+               mm->mmap = vma_next(mm, vma);
                delete_vma_from_mm(vma);
                delete_vma(mm, vma);
                cond_resched();
index cd241b174c81440fad098dbb42ada5bf6af60fb7..c6208a7407faeebd44ed8966cb69a9b21dd608b2 100644 (file)
--- a/mm/util.c
+++ b/mm/util.c
@@ -271,46 +271,6 @@ void *memdup_user_nul(const void __user *src, size_t len)
 }
 EXPORT_SYMBOL(memdup_user_nul);
 
-void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
-               struct vm_area_struct *prev)
-{
-       struct vm_area_struct *next;
-
-       vma->vm_prev = prev;
-       if (prev) {
-               next = prev->vm_next;
-               prev->vm_next = vma;
-       } else {
-               next = mm->mmap;
-               mm->mmap = vma;
-       }
-       vma->vm_next = next;
-       if (next)
-               next->vm_prev = vma;
-       else
-               mm->highest_vm_end = vm_end_gap(vma);
-}
-
-void __vma_unlink_list(struct mm_struct *mm, struct vm_area_struct *vma)
-{
-       struct vm_area_struct *prev, *next;
-
-       next = vma->vm_next;
-       prev = vma->vm_prev;
-       if (prev)
-               prev->vm_next = next;
-       else
-               mm->mmap = next;
-       if (next)
-               next->vm_prev = prev;
-       else {
-               if (prev)
-                       mm->highest_vm_end = vm_end_gap(prev);
-               else
-                       mm->highest_vm_end = 0;
-       }
-}
-
 /* Check if the vma is being used as a stack by this task */
 int vma_is_stack_for_current(struct vm_area_struct *vma)
 {