maple_tree-re-introduce-entry-to-mas_preallocate-arguments.patch removed from -mm tree
The quilt patch titled
Subject: maple_tree: re-introduce entry to mas_preallocate() arguments
has been removed from the -mm tree. Its filename was
maple_tree-re-introduce-entry-to-mas_preallocate-arguments.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" <[email protected]>
Subject: maple_tree: re-introduce entry to mas_preallocate() arguments
Date: Mon, 24 Jul 2023 14:31:49 -0400
The current preallocation strategy is to preallocate the absolute worst-case allocation for a tree modification. The entry (or NULL) is needed to know how many nodes are needed to write to the tree. Start by adding the argument to the mas_preallocate() definition.
---
include/linux/maple_tree.h | 2 - lib/maple_tree.c | 3 +- mm/internal.h | 2 - mm/mmap.c | 4 +-- tools/testing/radix-tree/maple.c | 32 ++++++++++++++--------------- 5 files changed, 22 insertions(+), 21 deletions(-)
include/linux/maple_tree.h renamed from include/linux/maple_tree.h~maple_tree-re-introduce-entry-to-mas_preallocate-arguments +1 -1
@@ -466,7 +466,7 @@ void *mas_find(struct ma_state *mas, unsvoid *mas_find_range (struct ma_state *mas,unsigned long max);void *mas_find_rev (struct ma_state *mas,unsigned long min);void *mas_find_range_rev (struct ma_state *mas,unsigned long max); -int mas_preallocate (struct ma_state *mas,gfp_t gfp); +int mas_preallocate (struct ma_state *mas,void *entry,gfp_t gfp);bool mas_is_err (struct ma_state *mas);bool mas_nomem (struct ma_state *mas,gfp_t gfp);
lib/maple_tree.c renamed from lib/maple_tree.c~maple_tree-re-introduce-entry-to-mas_preallocate-arguments +2 -1
@@ -5529,11 +5529,12 @@ EXPORT_SYMBOL_GPL(mas_store_prealloc);/** * mas_preallocate() - Preallocate enough nodes for a store operation * @mas: The maple state +* @entry: The entry that will be stored * @gfp: The GFP_FLAGS to use for allocations. * * Return: 0 on success, -ENOMEM if memory could not be allocated. */ -int mas_preallocate (struct ma_state *mas,gfp_t gfp) +int mas_preallocate (struct ma_state *mas,void *entry,gfp_t gfp) {int ret;
mm/internal.h renamed from mm/internal.h~maple_tree-re-introduce-entry-to-mas_preallocate-arguments +1 -1
@@ -1054,7 +1054,7 @@ static inline void vma_iter_config(struc*/ static inline int vma_iter_prealloc (struct vma_iterator *vmi) { -return mas_preallocate (&vmi->mas,GFP_KERNEL ); +return mas_preallocate (&vmi->mas,NULL ,GFP_KERNEL ); } static inline void vma_iter_clear(struct vma_iterator *vmi,
mm/mmap.c renamed from mm/mmap.c~maple_tree-re-introduce-entry-to-mas_preallocate-arguments +2 -2
@@ -1960,7 +1960,7 @@ static int expand_upwards(struct vm_area/* Check that both stack segments have the same anon_vma? */ } -if (mas_preallocate (&mas,GFP_KERNEL )) +if (mas_preallocate (&mas, vma,GFP_KERNEL ))return -ENOMEM ;/* We must make sure the anon_vma is allocated. */
@@ -2050,7 +2050,7 @@ int expand_downwards(struct vm_area_strureturn -ENOMEM ; } -if (mas_preallocate (&mas,GFP_KERNEL )) +if (mas_preallocate (&mas, vma,GFP_KERNEL ))return -ENOMEM ;/* We must make sure the anon_vma is allocated. */
tools/testing/radix-tree/maple.c renamed from tools/testing/radix-tree/maple.c~maple_tree-re-introduce-entry-to-mas_preallocate-arguments +16 -16
@@ -35458,7 +35458,7 @@ static noinline void __init check_preallfor (i =0 ; i <= max; i++)mtree_test_store_range (mt, i *10 , i *10 +5 , &i); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 ); allocated =mas_allocated (&mas); height =mas_mt_height (&mas);MT_BUG_ON (mt, allocated ==0 );
@@ -35467,18 +35467,18 @@ static noinline void __init check_preall allocated =mas_allocated (&mas);MT_BUG_ON (mt, allocated !=0 ); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 ); allocated =mas_allocated (&mas); height =mas_mt_height (&mas);MT_BUG_ON (mt, allocated ==0 );MT_BUG_ON (mt, allocated !=1 + height *3 ); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 );mas_destroy (&mas); allocated =mas_allocated (&mas);MT_BUG_ON (mt, allocated !=0 ); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 ); allocated =mas_allocated (&mas); height =mas_mt_height (&mas);MT_BUG_ON (mt, allocated ==0 );
@@ -35487,26 +35487,26 @@ static noinline void __init check_preallMT_BUG_ON (mt,mas_allocated (&mas) != allocated -1 ); mn->parent =ma_parent_ptr (mn);ma_free_rcu (mn); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 );mas_destroy (&mas); allocated =mas_allocated (&mas);MT_BUG_ON (mt, allocated !=0 ); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 ); allocated =mas_allocated (&mas); height =mas_mt_height (&mas);MT_BUG_ON (mt, allocated ==0 );MT_BUG_ON (mt, allocated !=1 + height *3 ); mn =mas_pop_node (&mas);MT_BUG_ON (mt,mas_allocated (&mas) != allocated -1 ); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 );mas_destroy (&mas); allocated =mas_allocated (&mas);MT_BUG_ON (mt, allocated !=0 ); mn->parent =ma_parent_ptr (mn);ma_free_rcu (mn); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 ); allocated =mas_allocated (&mas); height =mas_mt_height (&mas);MT_BUG_ON (mt, allocated ==0 );
@@ -35515,12 +35515,12 @@ static noinline void __init check_preallMT_BUG_ON (mt,mas_allocated (&mas) != allocated -1 );mas_push_node (&mas, mn);MT_BUG_ON (mt,mas_allocated (&mas) != allocated); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 );mas_destroy (&mas); allocated =mas_allocated (&mas);MT_BUG_ON (mt, allocated !=0 ); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 ); allocated =mas_allocated (&mas); height =mas_mt_height (&mas);MT_BUG_ON (mt, allocated ==0 );
@@ -35528,21 +35528,21 @@ static noinline void __init check_preallmas_store_prealloc (&mas, ptr);MT_BUG_ON (mt,mas_allocated (&mas) !=0 ); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 ); allocated =mas_allocated (&mas); height =mas_mt_height (&mas);MT_BUG_ON (mt, allocated ==0 );MT_BUG_ON (mt, allocated !=1 + height *3 );mas_store_prealloc (&mas, ptr);MT_BUG_ON (mt,mas_allocated (&mas) !=0 ); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 ); allocated =mas_allocated (&mas); height =mas_mt_height (&mas);MT_BUG_ON (mt, allocated ==0 );MT_BUG_ON (mt, allocated !=1 + height *3 );mas_store_prealloc (&mas, ptr); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 ); allocated =mas_allocated (&mas); height =mas_mt_height (&mas);MT_BUG_ON (mt, allocated ==0 );
@@ -35550,14 +35550,14 @@ static noinline void __init check_preallmas_store_prealloc (&mas, ptr);MT_BUG_ON (mt,mas_allocated (&mas) !=0 );mt_set_non_kernel (1 ); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL &GFP_NOWAIT ) ==0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL &GFP_NOWAIT ) ==0 ); allocated =mas_allocated (&mas); height =mas_mt_height (&mas);MT_BUG_ON (mt, allocated !=0 );mas_destroy (&mas); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL ) !=0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL ) !=0 ); allocated =mas_allocated (&mas); height =mas_mt_height (&mas);MT_BUG_ON (mt, allocated ==0 );
@@ -35565,7 +35565,7 @@ static noinline void __init check_preallmas_store_prealloc (&mas, ptr);MT_BUG_ON (mt,mas_allocated (&mas) !=0 );mt_set_non_kernel (1 ); -MT_BUG_ON (mt,mas_preallocate (&mas,GFP_KERNEL &GFP_NOWAIT ) ==0 ); +MT_BUG_ON (mt,mas_preallocate (&mas, ptr,GFP_KERNEL &GFP_NOWAIT ) ==0 ); allocated =mas_allocated (&mas); height =mas_mt_height (&mas);MT_BUG_ON (mt, allocated !=0 );
_
Patches currently in -mm which might be from [email protected] are
maple_tree-add-hex-output-to-maple_arange64-dump.patch maple_tree-reorder-replacement-of-nodes-to-avoid-live-lock.patch maple_tree-introduce-mas_put_in_tree.patch maple_tree-introduce-mas_tree_parent-definition.patch maple_tree-change-mas_adopt_children-parent-usage.patch maple_tree-replace-data-before-marking-dead-in-split-and-spanning-store.patch