]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: Move can_modify_vma to mm/vma.h
authorPedro Falcato <pedro.falcato@gmail.com>
Sat, 17 Aug 2024 00:18:28 +0000 (01:18 +0100)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 19 Aug 2024 20:11:54 +0000 (16:11 -0400)
Move can_modify_vma to vma.h so it can be inlined properly (with
the intent to remove can_modify_mm callsites).

Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
mm/mseal.c
mm/vma.h

index 15bba28acc005fdd8725f4dda8937bbf364433c2..2170e2139ca0a9143a942e2de41ced8181ebebd6 100644 (file)
 #include <linux/sched.h>
 #include "internal.h"
 
-static inline bool vma_is_sealed(struct vm_area_struct *vma)
-{
-       return (vma->vm_flags & VM_SEALED);
-}
-
 static inline void set_vma_sealed(struct vm_area_struct *vma)
 {
        vm_flags_set(vma, VM_SEALED);
 }
 
-/*
- * check if a vma is sealed for modification.
- * return true, if modification is allowed.
- */
-static bool can_modify_vma(struct vm_area_struct *vma)
-{
-       if (unlikely(vma_is_sealed(vma)))
-               return false;
-
-       return true;
-}
-
 static bool is_madv_discard(int behavior)
 {
        switch (behavior) {
index 6efdf1768a0abcff450d19a47ff1f2f19e5f5138..e979015cc7fc27ffe6869f7f23a83c433ff15e67 100644 (file)
--- a/mm/vma.h
+++ b/mm/vma.h
@@ -361,4 +361,32 @@ struct vm_area_struct *vma_iter_prev_range(struct vma_iterator *vmi)
        return mas_prev_range(&vmi->mas, 0);
 }
 
+#ifdef CONFIG_64BIT
+
+static inline bool vma_is_sealed(struct vm_area_struct *vma)
+{
+       return (vma->vm_flags & VM_SEALED);
+}
+
+/*
+ * check if a vma is sealed for modification.
+ * return true, if modification is allowed.
+ */
+static inline bool can_modify_vma(struct vm_area_struct *vma)
+{
+       if (unlikely(vma_is_sealed(vma)))
+               return false;
+
+       return true;
+}
+
+#else
+
+static inline bool can_modify_vma(struct vm_area_struct *vma)
+{
+       return true;
+}
+
+#endif
+
 #endif /* __MM_VMA_H */