On 12/13/23 6:24 AM, kernel test robot wrote:
tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
head: 4d9256c0c56bafd76b8b1517916451e168fae495
commit: 84bda0b24555d3fdf52b56040696ee1ee00700c9 [208/262] maple_tree: do not preallocate nodes for slot stores
config: arc-allnoconfig (https://download.01.org/0day-ci/archive/20231213/202312132207.KsGGGt1v-lkp@xxxxxxxxx/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231213/202312132207.KsGGGt1v-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312132207.KsGGGt1v-lkp@xxxxxxxxx/
Note: the akpm-mm/mm-unstable HEAD 4d9256c0c56bafd76b8b1517916451e168fae495 builds fine.
It only hurts bisectability.
All errors (new ones prefixed by >>):
lib/maple_tree.c: In function 'mas_preallocate':
lib/maple_tree.c:5506:30: error: 'struct ma_state' has no member named 'end'
5506 | if ((node_size == mas->end) && ((!mt_in_rcu(mas->tree))
| ^~
Hi Andrew,
I developed this patch over mm-unstable which contains the change to make end a
member of struct ma_state. But because this patch is a hotfix, it shouldn't have
been developed on top of feature commits that won't be a part of a 6.7 rc. I'll
send a v2 with the coding style changes and using wr_mas->node_end.
When this fix is merged into mm-unstable, it will cause another build error
because Liam's series [PATCH 00/12] maple_tree: iterator state changes[1] will
have to be updated to converting this patch's use of wr_mas->node.
Thanks,
Sid
[1]:
https://lore.kernel.org/all/20231101171629.3612299-5-Liam.Howlett@xxxxxxxxxx/T/#mc0e5000f6de822182bf7579c230030c5ec4ec1a7
vim +5506 lib/maple_tree.c
5465
5466 /**
5467 * mas_preallocate() - Preallocate enough nodes for a store operation
5468 * @mas: The maple state
5469 * @entry: The entry that will be stored
5470 * @gfp: The GFP_FLAGS to use for allocations.
5471 *
5472 * Return: 0 on success, -ENOMEM if memory could not be allocated.
5473 */
5474 int mas_preallocate(struct ma_state *mas, void *entry, gfp_t gfp)
5475 {
5476 MA_WR_STATE(wr_mas, mas, entry);
5477 unsigned char node_size;
5478 int request = 1;
5479 int ret;
5480
5481
5482 if (unlikely(!mas->index && mas->last == ULONG_MAX))
5483 goto ask_now;
5484
5485 mas_wr_store_setup(&wr_mas);
5486 wr_mas.content = mas_start(mas);
5487 /* Root expand */
5488 if (unlikely(mas_is_none(mas) || mas_is_ptr(mas)))
5489 goto ask_now;
5490
5491 if (unlikely(!mas_wr_walk(&wr_mas))) {
5492 /* Spanning store, use worst case for now */
5493 request = 1 + mas_mt_height(mas) * 3;
5494 goto ask_now;
5495 }
5496
5497 /* At this point, we are at the leaf node that needs to be altered. */
5498 /* Exact fit, no nodes needed. */
5499 if (wr_mas.r_min == mas->index && wr_mas.r_max == mas->last)
5500 return 0;
5501
5502 mas_wr_end_piv(&wr_mas);
5503 node_size = mas_wr_new_end(&wr_mas);
5504
5505 /* Slot store, does not require additional nodes */
5506 if ((node_size == mas->end) && ((!mt_in_rcu(mas->tree))
5507 || (wr_mas.offset_end - mas->offset == 1)))
5508 return 0;
5509
5510 if (node_size >= mt_slots[wr_mas.type]) {
5511 /* Split, worst case for now. */
5512 request = 1 + mas_mt_height(mas) * 2;
5513 goto ask_now;
5514 }
5515
5516 /* New root needs a singe node */
5517 if (unlikely(mte_is_root(mas->node)))
5518 goto ask_now;
5519
5520 /* Potential spanning rebalance collapsing a node, use worst-case */
5521 if (node_size - 1 <= mt_min_slots[wr_mas.type])
5522 request = mas_mt_height(mas) * 2 - 1;
5523
5524 /* node store, slot store needs one node */
5525 ask_now:
5526 mas_node_count_gfp(mas, request, gfp);
5527 mas->mas_flags |= MA_STATE_PREALLOC;
5528 if (likely(!mas_is_err(mas)))
5529 return 0;
5530
5531 mas_set_alloc_req(mas, 0);
5532 ret = xa_err(mas->node);
5533 mas_reset(mas);
5534 mas_destroy(mas);
5535 mas_reset(mas);
5536 return ret;
5537 }
5538 EXPORT_SYMBOL_GPL(mas_preallocate);
5539