public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [vbabka:slub-percpu-caches-v3r0 5/6] lib/maple_tree.c:5524:20: error: use of undeclared identifier 'MA_STATE_PREALLOC'
@ 2023-10-31 18:36 kernel test robot
  2023-11-01 18:10 ` Liam R. Howlett
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2023-10-31 18:36 UTC (permalink / raw)
  To: Liam R. Howlett; +Cc: llvm, oe-kbuild-all, Vlastimil Babka

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/linux.git slub-percpu-caches-v3r0
head:   dd3fcb0bdf513439374345254f4894675bc88e68
commit: bb07edc43f9f1a6119fa114f52d14df3f87e3241 [5/6] maple_tree: Remove MA_STATE_PREALLOC
config: um-allnoconfig (https://download.01.org/0day-ci/archive/20231101/202311010201.ktEJKmQ5-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231101/202311010201.ktEJKmQ5-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311010201.ktEJKmQ5-lkp@intel.com/

All errors (new ones prefixed by >>):

>> lib/maple_tree.c:5524:20: error: use of undeclared identifier 'MA_STATE_PREALLOC'
    5524 |         mas->mas_flags |= MA_STATE_PREALLOC;
         |                           ^
   1 error generated.


vim +/MA_STATE_PREALLOC +5524 lib/maple_tree.c

54a611b605901c7 Liam R. Howlett  2022-09-06  5468  
54a611b605901c7 Liam R. Howlett  2022-09-06  5469  /**
54a611b605901c7 Liam R. Howlett  2022-09-06  5470   * mas_preallocate() - Preallocate enough nodes for a store operation
54a611b605901c7 Liam R. Howlett  2022-09-06  5471   * @mas: The maple state
da0892547b101df Liam R. Howlett  2023-07-24  5472   * @entry: The entry that will be stored
54a611b605901c7 Liam R. Howlett  2022-09-06  5473   * @gfp: The GFP_FLAGS to use for allocations.
54a611b605901c7 Liam R. Howlett  2022-09-06  5474   *
54a611b605901c7 Liam R. Howlett  2022-09-06  5475   * Return: 0 on success, -ENOMEM if memory could not be allocated.
54a611b605901c7 Liam R. Howlett  2022-09-06  5476   */
da0892547b101df Liam R. Howlett  2023-07-24  5477  int mas_preallocate(struct ma_state *mas, void *entry, gfp_t gfp)
54a611b605901c7 Liam R. Howlett  2022-09-06  5478  {
17983dc617837a5 Liam R. Howlett  2023-07-24  5479  	MA_WR_STATE(wr_mas, mas, entry);
17983dc617837a5 Liam R. Howlett  2023-07-24  5480  	unsigned char node_size;
17983dc617837a5 Liam R. Howlett  2023-07-24  5481  	int request = 1;
54a611b605901c7 Liam R. Howlett  2022-09-06  5482  	int ret;
54a611b605901c7 Liam R. Howlett  2022-09-06  5483  
17983dc617837a5 Liam R. Howlett  2023-07-24  5484  
17983dc617837a5 Liam R. Howlett  2023-07-24  5485  	if (unlikely(!mas->index && mas->last == ULONG_MAX))
17983dc617837a5 Liam R. Howlett  2023-07-24  5486  		goto ask_now;
17983dc617837a5 Liam R. Howlett  2023-07-24  5487  
17983dc617837a5 Liam R. Howlett  2023-07-24  5488  	mas_wr_store_setup(&wr_mas);
17983dc617837a5 Liam R. Howlett  2023-07-24  5489  	wr_mas.content = mas_start(mas);
17983dc617837a5 Liam R. Howlett  2023-07-24  5490  	/* Root expand */
17983dc617837a5 Liam R. Howlett  2023-07-24  5491  	if (unlikely(mas_is_none(mas) || mas_is_ptr(mas)))
17983dc617837a5 Liam R. Howlett  2023-07-24  5492  		goto ask_now;
17983dc617837a5 Liam R. Howlett  2023-07-24  5493  
17983dc617837a5 Liam R. Howlett  2023-07-24  5494  	if (unlikely(!mas_wr_walk(&wr_mas))) {
17983dc617837a5 Liam R. Howlett  2023-07-24  5495  		/* Spanning store, use worst case for now */
17983dc617837a5 Liam R. Howlett  2023-07-24  5496  		request = 1 + mas_mt_height(mas) * 3;
17983dc617837a5 Liam R. Howlett  2023-07-24  5497  		goto ask_now;
17983dc617837a5 Liam R. Howlett  2023-07-24  5498  	}
17983dc617837a5 Liam R. Howlett  2023-07-24  5499  
17983dc617837a5 Liam R. Howlett  2023-07-24  5500  	/* At this point, we are at the leaf node that needs to be altered. */
17983dc617837a5 Liam R. Howlett  2023-07-24  5501  	/* Exact fit, no nodes needed. */
17983dc617837a5 Liam R. Howlett  2023-07-24  5502  	if (wr_mas.r_min == mas->index && wr_mas.r_max == mas->last)
17983dc617837a5 Liam R. Howlett  2023-07-24  5503  		return 0;
17983dc617837a5 Liam R. Howlett  2023-07-24  5504  
17983dc617837a5 Liam R. Howlett  2023-07-24  5505  	mas_wr_end_piv(&wr_mas);
17983dc617837a5 Liam R. Howlett  2023-07-24  5506  	node_size = mas_wr_new_end(&wr_mas);
17983dc617837a5 Liam R. Howlett  2023-07-24  5507  	if (node_size >= mt_slots[wr_mas.type]) {
17983dc617837a5 Liam R. Howlett  2023-07-24  5508  		/* Split, worst case for now. */
17983dc617837a5 Liam R. Howlett  2023-07-24  5509  		request = 1 + mas_mt_height(mas) * 2;
17983dc617837a5 Liam R. Howlett  2023-07-24  5510  		goto ask_now;
17983dc617837a5 Liam R. Howlett  2023-07-24  5511  	}
17983dc617837a5 Liam R. Howlett  2023-07-24  5512  
17983dc617837a5 Liam R. Howlett  2023-07-24  5513  	/* New root needs a singe node */
17983dc617837a5 Liam R. Howlett  2023-07-24  5514  	if (unlikely(mte_is_root(mas->node)))
17983dc617837a5 Liam R. Howlett  2023-07-24  5515  		goto ask_now;
17983dc617837a5 Liam R. Howlett  2023-07-24  5516  
17983dc617837a5 Liam R. Howlett  2023-07-24  5517  	/* Potential spanning rebalance collapsing a node, use worst-case */
17983dc617837a5 Liam R. Howlett  2023-07-24  5518  	if (node_size  - 1 <= mt_min_slots[wr_mas.type])
17983dc617837a5 Liam R. Howlett  2023-07-24  5519  		request = mas_mt_height(mas) * 2 - 1;
17983dc617837a5 Liam R. Howlett  2023-07-24  5520  
17983dc617837a5 Liam R. Howlett  2023-07-24  5521  	/* node store, slot store needs one node */
17983dc617837a5 Liam R. Howlett  2023-07-24  5522  ask_now:
17983dc617837a5 Liam R. Howlett  2023-07-24  5523  	mas_node_count_gfp(mas, request, gfp);
54a611b605901c7 Liam R. Howlett  2022-09-06 @5524  	mas->mas_flags |= MA_STATE_PREALLOC;
54a611b605901c7 Liam R. Howlett  2022-09-06  5525  	if (likely(!mas_is_err(mas)))
54a611b605901c7 Liam R. Howlett  2022-09-06  5526  		return 0;
54a611b605901c7 Liam R. Howlett  2022-09-06  5527  
54a611b605901c7 Liam R. Howlett  2022-09-06  5528  	mas_set_alloc_req(mas, 0);
54a611b605901c7 Liam R. Howlett  2022-09-06  5529  	ret = xa_err(mas->node);
54a611b605901c7 Liam R. Howlett  2022-09-06  5530  	mas_reset(mas);
54a611b605901c7 Liam R. Howlett  2022-09-06  5531  	mas_destroy(mas);
54a611b605901c7 Liam R. Howlett  2022-09-06  5532  	mas_reset(mas);
54a611b605901c7 Liam R. Howlett  2022-09-06  5533  	return ret;
54a611b605901c7 Liam R. Howlett  2022-09-06  5534  }
5c63a7c32a94a7e Danilo Krummrich 2023-03-02  5535  EXPORT_SYMBOL_GPL(mas_preallocate);
54a611b605901c7 Liam R. Howlett  2022-09-06  5536  

:::::: The code at line 5524 was first introduced by commit
:::::: 54a611b605901c7d5d05b6b8f5d04a6ceb0962aa Maple Tree: add new data structure

:::::: TO: Liam R. Howlett <Liam.Howlett@Oracle.com>
:::::: CC: Andrew Morton <akpm@linux-foundation.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [vbabka:slub-percpu-caches-v3r0 5/6] lib/maple_tree.c:5524:20: error: use of undeclared identifier 'MA_STATE_PREALLOC'
  2023-10-31 18:36 [vbabka:slub-percpu-caches-v3r0 5/6] lib/maple_tree.c:5524:20: error: use of undeclared identifier 'MA_STATE_PREALLOC' kernel test robot
@ 2023-11-01 18:10 ` Liam R. Howlett
  0 siblings, 0 replies; 2+ messages in thread
From: Liam R. Howlett @ 2023-11-01 18:10 UTC (permalink / raw)
  To: kernel test robot; +Cc: llvm, oe-kbuild-all, Vlastimil Babka

[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]

* kernel test robot <lkp@intel.com> [231031 14:37]:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/linux.git slub-percpu-caches-v3r0
> head:   dd3fcb0bdf513439374345254f4894675bc88e68
> commit: bb07edc43f9f1a6119fa114f52d14df3f87e3241 [5/6] maple_tree: Remove MA_STATE_PREALLOC
> config: um-allnoconfig (https://download.01.org/0day-ci/archive/20231101/202311010201.ktEJKmQ5-lkp@intel.com/config)
> compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231101/202311010201.ktEJKmQ5-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202311010201.ktEJKmQ5-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
> >> lib/maple_tree.c:5524:20: error: use of undeclared identifier 'MA_STATE_PREALLOC'
>     5524 |         mas->mas_flags |= MA_STATE_PREALLOC;
>          |                           ^

Ah, this line was added between revisions of your patch set.  Please
find the attached updated patch.

Thanks,
Liam

[-- Attachment #2: 0001-maple_tree-Remove-MA_STATE_PREALLOC.patch --]
[-- Type: text/x-diff, Size: 3192 bytes --]

From af838134b03fb25b664b118fa15f01c78e68d91a Mon Sep 17 00:00:00 2001
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Date: Tue, 8 Aug 2023 14:54:27 -0400
Subject: [PATCH 1/2] maple_tree: Remove MA_STATE_PREALLOC

MA_SATE_PREALLOC was added to catch any writes that try to allocate when
the maple state is being used in preallocation mode.  This can safely be
removed in favour of the percpu array of nodes.

Note that mas_expected_entries() still expects no allocations during
operation and so MA_STATE_BULK can be used in place of preallocations
for this case, which is primarily used for forking.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 lib/maple_tree.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 124e837b3153..81f4a4f45751 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -68,11 +68,9 @@
  * Maple state flags
  * * MA_STATE_BULK		- Bulk insert mode
  * * MA_STATE_REBALANCE		- Indicate a rebalance during bulk insert
- * * MA_STATE_PREALLOC		- Preallocated nodes, WARN_ON allocation
  */
 #define MA_STATE_BULK		1
 #define MA_STATE_REBALANCE	2
-#define MA_STATE_PREALLOC	4
 
 #define ma_parent_ptr(x) ((struct maple_pnode *)(x))
 #define mas_tree_parent(x) ((unsigned long)(x->tree) | MA_ROOT_PARENT)
@@ -1263,11 +1261,8 @@ static inline void mas_alloc_nodes(struct ma_state *mas, gfp_t gfp)
 		return;
 
 	mas_set_alloc_req(mas, 0);
-	if (mas->mas_flags & MA_STATE_PREALLOC) {
-		if (allocated)
-			return;
-		WARN_ON(!allocated);
-	}
+	if (mas->mas_flags & MA_STATE_BULK)
+		return;
 
 	if (!allocated || mas->alloc->node_count == MAPLE_ALLOC_SLOTS) {
 		node = (struct maple_alloc *)mt_alloc_one(gfp);
@@ -5526,7 +5521,6 @@ int mas_preallocate(struct ma_state *mas, void *entry, gfp_t gfp)
 	/* node store, slot store needs one node */
 ask_now:
 	mas_node_count_gfp(mas, request, gfp);
-	mas->mas_flags |= MA_STATE_PREALLOC;
 	if (likely(!mas_is_err(mas)))
 		return 0;
 
@@ -5569,7 +5563,7 @@ void mas_destroy(struct ma_state *mas)
 
 		mas->mas_flags &= ~MA_STATE_REBALANCE;
 	}
-	mas->mas_flags &= ~(MA_STATE_BULK|MA_STATE_PREALLOC);
+	mas->mas_flags &= ~MA_STATE_BULK;
 
 	total = mas_allocated(mas);
 	while (total) {
@@ -5618,9 +5612,6 @@ int mas_expected_entries(struct ma_state *mas, unsigned long nr_entries)
 	 * of nodes during the operation.
 	 */
 
-	/* Optimize splitting for bulk insert in-order */
-	mas->mas_flags |= MA_STATE_BULK;
-
 	/*
 	 * Avoid overflow, assume a gap between each entry and a trailing null.
 	 * If this is wrong, it just means allocation can happen during
@@ -5637,8 +5628,9 @@ int mas_expected_entries(struct ma_state *mas, unsigned long nr_entries)
 	/* Add working room for split (2 nodes) + new parents */
 	mas_node_count_gfp(mas, nr_nodes + 3, GFP_KERNEL);
 
-	/* Detect if allocations run out */
-	mas->mas_flags |= MA_STATE_PREALLOC;
+	/* Optimize splitting for bulk insert in-order */
+	mas->mas_flags |= MA_STATE_BULK;
+
 
 	if (!mas_is_err(mas))
 		return 0;
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-01 18:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31 18:36 [vbabka:slub-percpu-caches-v3r0 5/6] lib/maple_tree.c:5524:20: error: use of undeclared identifier 'MA_STATE_PREALLOC' kernel test robot
2023-11-01 18:10 ` Liam R. Howlett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox