]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: introduce mod_vm_flags_nolock
authorSuren Baghdasaryan <surenb@google.com>
Tue, 8 Nov 2022 19:15:56 +0000 (19:15 +0000)
committerSuren Baghdasaryan <surenb@google.com>
Wed, 23 Nov 2022 02:09:47 +0000 (02:09 +0000)
In cases when VMA flags are modified after VMA was isolated and mmap_lock
was downgraded, flags modifications do not require per-VMA locking and
an attempt to lock the VMA would result in an assertion because mmap
write lock is not held.
Introduce mod_vm_flags_nolock to be used in such situation.

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
include/linux/mm.h

index 31abff298fe0bec521c98d04202b9ee83ee51181..cb2d7f8ae53230aed5db8eacf5d7b0466a2a87c0 100644 (file)
@@ -742,6 +742,14 @@ void clear_vm_flags(struct vm_area_struct *vma, unsigned long flags)
        vma->vm_flags &= ~flags;
 }
 
+static inline
+void mod_vm_flags_nolock(struct vm_area_struct *vma,
+                 unsigned long set, unsigned long clear)
+{
+       vma->vm_flags |= set;
+       vma->vm_flags &= ~clear;
+}
+
 static inline
 void mod_vm_flags(struct vm_area_struct *vma,
                  unsigned long set, unsigned long clear)