mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	maple_tree: update mas_preallocate() testing
Since the mas_preallocate() calculation has been updated to be more precise, the testing must also be updated to check for what is expected. Link: https://lkml.kernel.org/r/20230724183157.3939892-13-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> Cc: Peng Zhang <zhangpeng.00@bytedance.com> Cc: Suren Baghdasaryan <surenb@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									a7496ad529
								
							
						
					
					
						commit
						0b8bb544b1
					
				
					 1 changed files with 20 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -35458,6 +35458,8 @@ static noinline void __init check_prealloc(struct maple_tree *mt)
 | 
			
		|||
	for (i = 0; i <= max; i++)
 | 
			
		||||
		mtree_test_store_range(mt, i * 10, i * 10 + 5, &i);
 | 
			
		||||
 | 
			
		||||
	/* Spanning store */
 | 
			
		||||
	mas_set_range(&mas, 470, 500);
 | 
			
		||||
	MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0);
 | 
			
		||||
	allocated = mas_allocated(&mas);
 | 
			
		||||
	height = mas_mt_height(&mas);
 | 
			
		||||
| 
						 | 
				
			
			@ -35481,7 +35483,6 @@ static noinline void __init check_prealloc(struct maple_tree *mt)
 | 
			
		|||
	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);
 | 
			
		||||
| 
						 | 
				
			
			@ -35495,7 +35496,6 @@ static noinline void __init check_prealloc(struct maple_tree *mt)
 | 
			
		|||
	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);
 | 
			
		||||
| 
						 | 
				
			
			@ -35509,7 +35509,6 @@ static noinline void __init check_prealloc(struct maple_tree *mt)
 | 
			
		|||
	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);
 | 
			
		||||
| 
						 | 
				
			
			@ -35523,33 +35522,37 @@ static noinline void __init check_prealloc(struct maple_tree *mt)
 | 
			
		|||
	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);
 | 
			
		||||
 | 
			
		||||
	/* Slot store does not need allocations */
 | 
			
		||||
	mas_set_range(&mas, 6, 9);
 | 
			
		||||
	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, allocated != 0);
 | 
			
		||||
	mas_store_prealloc(&mas, ptr);
 | 
			
		||||
	MT_BUG_ON(mt, mas_allocated(&mas) != 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);
 | 
			
		||||
 | 
			
		||||
	mas_set_range(&mas, 6, 10);
 | 
			
		||||
	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, allocated != 1);
 | 
			
		||||
	mas_store_prealloc(&mas, ptr);
 | 
			
		||||
	MT_BUG_ON(mt, mas_allocated(&mas) != 0);
 | 
			
		||||
 | 
			
		||||
	/* Split */
 | 
			
		||||
	mas_set_range(&mas, 54, 54);
 | 
			
		||||
	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 != 1 + height * 2);
 | 
			
		||||
	mas_store_prealloc(&mas, ptr);
 | 
			
		||||
	MT_BUG_ON(mt, mas_allocated(&mas) != 0);
 | 
			
		||||
	mt_set_non_kernel(1);
 | 
			
		||||
	/* Spanning store */
 | 
			
		||||
	mas_set_range(&mas, 1, 100);
 | 
			
		||||
	MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL & GFP_NOWAIT) == 0);
 | 
			
		||||
	allocated = mas_allocated(&mas);
 | 
			
		||||
	height = mas_mt_height(&mas);
 | 
			
		||||
| 
						 | 
				
			
			@ -35557,6 +35560,7 @@ static noinline void __init check_prealloc(struct maple_tree *mt)
 | 
			
		|||
	mas_destroy(&mas);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/* Spanning store */
 | 
			
		||||
	MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0);
 | 
			
		||||
	allocated = mas_allocated(&mas);
 | 
			
		||||
	height = mas_mt_height(&mas);
 | 
			
		||||
| 
						 | 
				
			
			@ -35564,6 +35568,7 @@ static noinline void __init check_prealloc(struct maple_tree *mt)
 | 
			
		|||
	MT_BUG_ON(mt, allocated != 1 + height * 3);
 | 
			
		||||
	mas_store_prealloc(&mas, ptr);
 | 
			
		||||
	MT_BUG_ON(mt, mas_allocated(&mas) != 0);
 | 
			
		||||
	mas_set_range(&mas, 0, 200);
 | 
			
		||||
	mt_set_non_kernel(1);
 | 
			
		||||
	MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL & GFP_NOWAIT) == 0);
 | 
			
		||||
	allocated = mas_allocated(&mas);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue