]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: Move vma_mas_store()/vma_mas_erase() to internal header.
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 23 Feb 2021 15:49:13 +0000 (10:49 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 23 Feb 2021 15:49:13 +0000 (10:49 -0500)
These are used in nommu case as well

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mm/internal.h
mm/mmap.c

index c4cf64fe40d78006864df087952392329bcde274..c00c8423789ef22c9b0e9008ab02f41a8bbfc4e6 100644 (file)
@@ -332,6 +332,50 @@ static inline bool is_data_mapping(vm_flags_t flags)
        return (flags & (VM_WRITE | VM_SHARED | VM_STACK)) == VM_WRITE;
 }
 
+/* Maple tree operations using VMAs */
+/*
+ * vma_mas_store() - Store a VMA in the maple tree.
+ * @vma: The vm_area_struct
+ * @mas: The maple state
+ *
+ * Efficient way to store a VMA in the maple tree when the @mas has already
+ * walked to the correct location.
+ *
+ * Note: the end address is inclusive in the maple tree.
+ */
+static inline int vma_mas_store(struct vm_area_struct *vma, struct ma_state *mas)
+{
+       int ret;
+
+       mas->index = vma->vm_start;
+       mas->last = vma->vm_end - 1;
+       mas_lock(mas);
+       ret = mas_store_gfp(mas, vma, GFP_KERNEL);
+       mas_unlock(mas);
+       return ret;
+}
+
+/*
+ * vma_mas_remove() - Remove a VMA from the maple tree.
+ * @vma: The vm_area_struct
+ * @mas: The maple state
+ *
+ * Efficient way to remove a VMA from the maple tree when the @mas has already
+ * been established and points to the correct location.
+ * Note: the end address is inclusive in the maple tree.
+ */
+static inline int vma_mas_remove(struct vm_area_struct *vma, struct ma_state *mas)
+{
+       int ret;
+
+       mas->index = vma->vm_start;
+       mas->last = vma->vm_end - 1;
+       mas_lock(mas);
+       ret = mas_store_gfp(mas, NULL, GFP_KERNEL);
+       mas_unlock(mas);
+       return ret;
+}
+
 /* mm/util.c */
 void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
                struct vm_area_struct *prev);
index 52762e1a9787a52fc36d3d93cadc4245fced26c1..5387a1ced7769c55de37a0499cf9545be7eb4567 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -442,49 +442,6 @@ static void __vma_link_file(struct vm_area_struct *vma)
        }
 }
 
-/*
- * vma_mas_store() - Store a VMA in the maple tree.
- * @vma: The vm_area_struct
- * @mas: The maple state
- *
- * Efficient way to store a VMA in the maple tree when the @mas has already
- * walked to the correct location.
- *
- * Note: the end address is inclusive in the maple tree.
- */
-static inline int vma_mas_store(struct vm_area_struct *vma, struct ma_state *mas)
-{
-       int ret;
-
-       mas->index = vma->vm_start;
-       mas->last = vma->vm_end - 1;
-       mas_lock(mas);
-       ret = mas_store_gfp(mas, vma, GFP_KERNEL);
-       mas_unlock(mas);
-       return ret;
-}
-
-/*
- * vma_mas_remove() - Remove a VMA from the maple tree.
- * @vma: The vm_area_struct
- * @mas: The maple state
- *
- * Efficient way to remove a VMA from the maple tree when the @mas has already
- * been established and points to the correct location.
- * Note: the end address is inclusive in the maple tree.
- */
-static inline int vma_mas_remove(struct vm_area_struct *vma, struct ma_state *mas)
-{
-       int ret;
-
-       mas->index = vma->vm_start;
-       mas->last = vma->vm_end - 1;
-       mas_lock(mas);
-       ret = mas_store_gfp(mas, NULL, GFP_KERNEL);
-       mas_unlock(mas);
-       return ret;
-}
-
 /*
  * vma_mt_szero() - Set a given range to zero.  Used when modifying a
  * vm_area_struct start or end.