]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: linked list many+1
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 15 Dec 2020 20:21:51 +0000 (15:21 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:33:39 +0000 (12:33 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mm/memory.c
mm/mmap.c

index 4316611a6681018f2b054fdac4f8ebc975b60312..1375638621abf59ab6581258a7e9f92c2a3fdc4f 100644 (file)
@@ -392,9 +392,10 @@ void free_mt_pgtables(struct mmu_gather *tlb, struct vm_area_struct *vma,
 {
        struct ma_state ma_next = *mas;
 
-       mas_find(&ma_next, ceiling - 1);
-       mas_for_each(mas, vma, ceiling - 1) {
-               struct vm_area_struct *next = mas_find(&ma_next, ceiling - 1);
+       ceiling--;
+       mas_find(&ma_next, ceiling);
+       mas_for_each(mas, vma, ceiling) {
+               struct vm_area_struct *next = mas_find(&ma_next, ceiling);
                unsigned long addr = vma->vm_start;
 
                /*
@@ -413,8 +414,8 @@ void free_mt_pgtables(struct mmu_gather *tlb, struct vm_area_struct *vma,
                         */
                        while (next && next->vm_start <= vma->vm_end + PMD_SIZE
                               && !is_vm_hugetlb_page(next)) {
-                               next = mas_find(&ma_next, ceiling - 1);
-                               vma = mas_find(mas, ceiling - 1);
+                               next = mas_find(&ma_next, ceiling);
+                               vma = mas_find(mas, ceiling);
                                unlink_anon_vmas(vma);
                                unlink_file_vma(vma);
                        }
index ba3c6a52034f1e3668972ef756e9885453e7d337..9e5f29013dbd0e6daa590c9a66291d03b0ceba50 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2369,7 +2369,7 @@ static inline unsigned long detach_range(struct mm_struct *mm,
        /* Set the upper limit */
        if (!tmp) {
                mm->highest_vm_end = prev ? vm_end_gap(prev) : 0;
-               return mm->highest_vm_end;
+               return USER_PGTABLES_CEILING;
        }
 
        return tmp->vm_start;
@@ -3159,7 +3159,7 @@ void exit_mmap(struct mm_struct *mm)
        struct mmu_gather tlb;
        struct vm_area_struct *vma;
        unsigned long nr_accounted = 0;
-       MA_STATE(mas, &mm->mm_mt, 0, 0);
+       MA_STATE(mas, &mm->mm_mt, FIRST_USER_ADDRESS, FIRST_USER_ADDRESS);
 
        /* mm's last user has gone, and its about to be pulled down */
        mmu_notifier_release(mm);
@@ -3196,7 +3196,7 @@ void exit_mmap(struct mm_struct *mm)
                        }
                }
                mas_reset(&mas);
-               mas_set(&mas, 0);
+               mas_set(&mas, FIRST_USER_ADDRESS);
        }
 
        arch_exit_mmap(mm);
@@ -3209,8 +3209,6 @@ void exit_mmap(struct mm_struct *mm)
        flush_cache_mm(mm);
        tlb_gather_mmu(&tlb, mm, 0, -1);
        /* update_hiwater_rss(mm) here? but nobody should be looking */
-       mas_reset(&mas);
-       mas_set(&mas, FIRST_USER_ADDRESS);
        /* Use 0 here to ensure all VMAs in the mm are unmapped */
 //     unmap_vmas(&tlb, vma, 0, -1);
        unmap_vmas_mt(&tlb, vma, &mas, 0, -1);