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);
}
}
-/*
- * 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.