]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: Move maple tree operators from mmap to internal.h header.
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 25 Jan 2021 19:33:44 +0000 (14:33 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 25 Jan 2021 19:33:44 +0000 (14:33 -0500)
Prepare for nommu changes

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

index aaf382dbee14e84aa3c4111ae4f9b083c0c42a29..af9fcd2191912c0c467ef64644386d3f0d6328a2 100644 (file)
@@ -618,4 +618,67 @@ struct migration_target_control {
        gfp_t gfp_mask;
 };
 
+
+/*
+ * 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)
+{
+       mas->index = vma->vm_start;
+       mas->last = vma->vm_end - 1;
+       return mas_store_gfp(mas, vma, GFP_KERNEL);
+}
+
+/*
+ * 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)
+{
+       mas->index = vma->vm_start;
+       mas->last = vma->vm_end - 1;
+       return mas_store_gfp(mas, NULL, GFP_KERNEL);
+}
+
+/*
+ * 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.
+ */
+static inline void vma_mt_szero(struct mm_struct *mm, unsigned long start,
+               unsigned long end)
+{
+       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.
+ */
+static inline void vma_mt_store(struct mm_struct *mm, struct vm_area_struct *vma)
+{
+       trace_vma_mt_store(mm, vma);
+       mtree_store_range(&mm->mm_mt, vma->vm_start, vma->vm_end - 1, vma,
+               GFP_KERNEL);
+}
+
+
 #endif /* __MM_INTERNAL_H */
index b7f6e27411adf4591aad84f2947203252ba1e35c..c1e68091a05c6c4a2e5f538d2584cf8328697436 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -430,68 +430,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)
-{
-       mas->index = vma->vm_start;
-       mas->last = vma->vm_end - 1;
-       return mas_store_gfp(mas, vma, GFP_KERNEL);
-}
-
-/*
- * 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)
-{
-       mas->index = vma->vm_start;
-       mas->last = vma->vm_end - 1;
-       return mas_store_gfp(mas, NULL, GFP_KERNEL);
-}
-
-/*
- * 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.
- */
-static inline void vma_mt_szero(struct mm_struct *mm, unsigned long start,
-               unsigned long end)
-{
-       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.
- */
-static inline void vma_mt_store(struct mm_struct *mm, struct vm_area_struct *vma)
-{
-       trace_vma_mt_store(mm, vma);
-       mtree_store_range(&mm->mm_mt, vma->vm_start, vma->vm_end - 1, vma,
-               GFP_KERNEL);
-}
-
-
 static void vma_mas_link(struct mm_struct *mm, struct vm_area_struct *vma,
                         struct ma_state *mas)
 {