fixup after maple/mainline sync
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:37:08 +0000 (12:37 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:37:08 +0000 (12:37 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
arch/powerpc/oprofile/cell/spu_task_sync.c
drivers/oprofile/buffer_sync.c
include/linux/mm.h
include/linux/mm_types.h
include/trace/events/mmap.h
mm/mmap.c
mm/nommu.c

index c1d59a255060036df2fad2bdebfdbb8b56038578..47b4d4e9b628d1580c2286fb9d20ba4d93cca9db 100644 (file)
@@ -321,7 +321,6 @@ get_exec_dcookie_and_offset(struct spu *spu, unsigned int *offsetp,
        struct vm_area_struct *vma;
        struct file *exe_file;
        struct mm_struct *mm = spu->mm;
-       MA_STATE(mas, &mm->mm_mt, spu_ref, spu_ref);
 
        if (!mm)
                goto out;
@@ -334,7 +333,7 @@ get_exec_dcookie_and_offset(struct spu *spu, unsigned int *offsetp,
        }
 
        mmap_read_lock(mm);
-       vma = mas_walk(&mas);
+       vma = find_vma_intersection(mm, spu_ref, spu_ref + 1);
        if (!vma)
                goto fail_no_image_cookie;
 
index fbb43edad41b580b93a54baf9b9b9b1694c501d8..c63703b3bcebe0a5671f92cea0bc804a066a81c3 100644 (file)
@@ -253,7 +253,7 @@ done:
 static unsigned long
 lookup_dcookie(struct mm_struct *mm, unsigned long addr, off_t *offset)
 {
-       unsigned long cookie = NO_COOKIE;
+       unsigned long cookie = INVALID_COOKIE;
        struct vm_area_struct *vma;
 
        mmap_read_lock(mm);
@@ -266,9 +266,9 @@ lookup_dcookie(struct mm_struct *mm, unsigned long addr, off_t *offset)
                } else {
                        /* must be an anonymous map */
                        *offset = addr;
+                       cookie = NO_COOKIE;
                }
-       } else
-               cookie = INVALID_COOKIE;
+       }
 
        mmap_read_unlock(mm);
 
index 1b8900398a654ebffd47a2472811d3d0603e1eef..99b1dec97495a19c236bd348e6b50d42366ae40e 100644 (file)
@@ -2573,7 +2573,7 @@ extern unsigned long mmap_region(struct file *file, unsigned long addr,
 extern unsigned long do_mmap(struct file *file, unsigned long addr,
        unsigned long len, unsigned long prot, unsigned long flags,
        unsigned long pgoff, unsigned long *populate, struct list_head *uf);
-extern int do_mas_munmap(struct ma_state *mas,struct mm_struct *mm,
+extern int do_mas_munmap(struct ma_state *mas, struct mm_struct *mm,
         unsigned long start, size_t len, struct list_head *uf, bool downgrade);
 extern int do_munmap(struct mm_struct *, unsigned long, size_t,
                     struct list_head *uf);
index 2548f9bda064130a934b9caa40aab4026431e019..630673866af948c03e92c088109cb2af035dc3f8 100644 (file)
@@ -319,7 +319,8 @@ struct vm_area_struct {
 
        /* Information about our backing store: */
        unsigned long vm_pgoff;         /* Offset (within vm_file) in PAGE_SIZE
-                                          units */
+                                        * units
+                                        */
        struct file * vm_file;          /* File we map to (can be NULL). */
        /*
         * For areas with an address space and backing store,
index 9a6dd70b427fb126d8c541226f2a7f33b89d8cef..4ffe3d348966f0e1b84f1fb4fd51b43d69bbb92f 100644 (file)
@@ -42,32 +42,6 @@ TRACE_EVENT(vm_unmapped_area,
                __entry->low_limit, __entry->high_limit, __entry->align_mask,
                __entry->align_offset)
 );
-TRACE_EVENT(vma_mt_erase,
-
-       TP_PROTO(struct mm_struct *mm, struct vm_area_struct *vma),
-
-       TP_ARGS(mm, vma),
-
-       TP_STRUCT__entry(
-                       __field(struct mm_struct *, mm)
-                       __field(struct vm_area_struct *, vma)
-                       __field(unsigned long, vm_start)
-                       __field(unsigned long, vm_end)
-       ),
-
-       TP_fast_assign(
-                       __entry->mm             = mm;
-                       __entry->vma            = vma;
-                       __entry->vm_start       = vma->vm_start;
-                       __entry->vm_end         = vma->vm_end - 1;
-       ),
-
-       TP_printk("mt_mod %px, (%px), ERASE, %lu, %lu,",
-                 __entry->mm, __entry->vma,
-                 (unsigned long) __entry->vm_start,
-                 (unsigned long) __entry->vm_end
-       )
-);
 
 TRACE_EVENT(vma_mt_szero,
        TP_PROTO(struct mm_struct *mm, unsigned long start,
index 36b4c05748f62493c93c8d462dd9a9e815d57bff..b4ed8be4899b8b87a775762d7c5cc48b8b21df85 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -464,14 +464,12 @@ static inline int vma_mas_remove(struct vm_area_struct *vma, struct ma_state *ma
 }
 
 /*
- * vma_mt_szero() - Clear a given range from the maple tree.
+ * vma_mt_szero() - Set a given range to zero.  Used when modifying a
+ * vm_area_struct start or end.
+ *
  * @mm: The struct_mm
  * @start: The start address to zero
  * @end: The end address to zero.
- *
- * Used when modifying a vm_area_struct start or end and there is no maple state
- * pointing to the correct location.
- * Note: the end address is inclusive in the maple tree.
  */
 static inline void vma_mt_szero(struct mm_struct *mm, unsigned long start,
                unsigned long end)
@@ -479,13 +477,12 @@ static inline void vma_mt_szero(struct mm_struct *mm, unsigned long start,
        trace_vma_mt_szero(mm, start, end);
        mtree_store_range(&mm->mm_mt, start, end - 1, NULL, GFP_KERNEL);
 }
+
 /*
  * vma_mt_store() - Store a given vm_area_struct in the maple tree.
+ *
  * @mm: The struct_mm
  * @vma: The vm_area_struct to store in the maple tree.
- *
- * Used when there is no maple state pointing to the correct location.
- * Note: the end address is inclusive in the maple tree.
  */
 static inline void vma_mt_store(struct mm_struct *mm, struct vm_area_struct *vma)
 {
@@ -514,6 +511,7 @@ static void vma_mas_link(struct mm_struct *mm, struct vm_area_struct *vma,
        mm->map_count++;
        validate_mm(mm);
 }
+
 static void vma_link(struct mm_struct *mm, struct vm_area_struct *vma)
 {
        MA_STATE(mas, &mm->mm_mt, vma->vm_start, vma->vm_end - 1);
@@ -2200,7 +2198,6 @@ static void unmap_region(struct mm_struct *mm,
                      max);
        tlb_finish_mmu(&tlb, start, end);
 }
-
 /*
  * __split_vma() bypasses sysctl_max_map_count checking.  We use this where it
  * has already been checked or doesn't make sense to fail.
@@ -2891,7 +2888,8 @@ static int do_brk_munmap(struct ma_state *mas, struct vm_area_struct *vma,
 
        if (likely(vma->vm_start >= newbrk)) { // remove entire mapping(s)
                mas->last = oldbrk - 1;
-               ret = do_mas_align_munmap(mas, vma, mm, newbrk, oldbrk, uf, true);
+               ret = do_mas_align_munmap(mas, vma, mm, newbrk, oldbrk, uf,
+                                         true);
                goto munmap_full_vma;
        }
 
index 4e5cc63728b654bc607b43674135f3a86e5b82fa..a3f97a612f16ab8e5b50a78849f69bb93217bd4c 100644 (file)
@@ -617,8 +617,6 @@ static void add_vma_to_mm(struct mm_struct *mm, struct vm_area_struct *vma)
        prev = NULL;
        if (rb_prev)
                prev = rb_entry(rb_prev, struct vm_area_struct, vm_rb);
-
-       __vma_link_list(mm, vma, prev);
 }
 
 /*
@@ -653,8 +651,6 @@ static void delete_vma_from_mm(struct vm_area_struct *vma)
 
        /* remove from the MM's tree and list */
        rb_erase(&vma->vm_rb, &mm->mm_rb);
-
-       __vma_unlink_list(mm, vma);
 }
 
 /*