* [merged mm-stable] mm-mmap-remove-preallocation-from-do_mas_align_munmap.patch removed from -mm tree
@ 2023-02-10 0:52 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2023-02-10 0:52 UTC (permalink / raw)
To: mm-commits, Liam.Howlett, Liam.Howlett, akpm
The quilt patch titled
Subject: mm/mmap: remove preallocation from do_mas_align_munmap()
has been removed from the -mm tree. Its filename was
mm-mmap-remove-preallocation-from-do_mas_align_munmap.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
Subject: mm/mmap: remove preallocation from do_mas_align_munmap()
Date: Fri, 20 Jan 2023 11:26:12 -0500
In preparation of passing the vma state through split, the pre-allocation
that occurs before the split has to be moved to after. Since the
preallocation would then live right next to the store, just call store
instead of preallocating. This effectively restores the potential error
path of splitting and not munmap'ing which pre-dates the maple tree.
Link: https://lkml.kernel.org/r/20230120162650.984577-12-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/mmap.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
--- a/mm/mmap.c~mm-mmap-remove-preallocation-from-do_mas_align_munmap
+++ a/mm/mmap.c
@@ -2329,9 +2329,6 @@ do_mas_align_munmap(struct ma_state *mas
mt_init_flags(&mt_detach, MT_FLAGS_LOCK_EXTERN);
mt_set_external_lock(&mt_detach, &mm->mmap_lock);
- if (mas_preallocate(mas, GFP_KERNEL))
- return -ENOMEM;
-
mas->last = end - 1;
/*
* If we need to split any vma, do it now to save pain later.
@@ -2422,8 +2419,6 @@ do_mas_align_munmap(struct ma_state *mas
goto userfaultfd_error;
}
- /* Point of no return */
- mas_set_range(mas, start, end - 1);
#if defined(CONFIG_DEBUG_VM_MAPLE_TREE)
/* Make sure no VMAs are about to be lost. */
{
@@ -2431,6 +2426,7 @@ do_mas_align_munmap(struct ma_state *mas
struct vm_area_struct *vma_mas, *vma_test;
int test_count = 0;
+ mas_set_range(mas, start, end - 1);
rcu_read_lock();
vma_test = mas_find(&test, end - 1);
mas_for_each(mas, vma_mas, end - 1) {
@@ -2440,10 +2436,13 @@ do_mas_align_munmap(struct ma_state *mas
}
rcu_read_unlock();
BUG_ON(count != test_count);
- mas_set_range(mas, start, end - 1);
}
#endif
- mas_store_prealloc(mas, NULL);
+ /* Point of no return */
+ mas_set_range(mas, start, end - 1);
+ if (mas_store_gfp(mas, NULL, GFP_KERNEL))
+ return -ENOMEM;
+
mm->map_count -= count;
/*
* Do not downgrade mmap_lock if we are next to VM_GROWSDOWN or
@@ -2475,7 +2474,6 @@ end_split_failed:
__mt_destroy(&mt_detach);
start_split_failed:
map_count_exceeded:
- mas_destroy(mas);
return error;
}
_
Patches currently in -mm which might be from Liam.Howlett@Oracle.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-10 0:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10 0:52 [merged mm-stable] mm-mmap-remove-preallocation-from-do_mas_align_munmap.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.