The patch titled Subject: maple_tree: use metadata for mas_dead_leaves() walk has been added to the -mm mm-unstable branch. Its filename is maple-tree-add-new-data-structure-fix-6.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/maple-tree-add-new-data-structure-fix-6.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Liam Howlett <liam.howlett@xxxxxxxxxx> Subject: maple_tree: use metadata for mas_dead_leaves() walk Date: Fri, 15 Jul 2022 19:43:08 +0000 When walking the dead leaves, use the nodes metadata for the end of the node. This avoids needing to use tricks for BE/LE unions. Link: https://lkml.kernel.org/r/20220715194258.1734056-1-Liam.Howlett@xxxxxxxxxx Fixes: d0aac5e48048 (Maple Tree: add new data structure) Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/maple_tree.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) --- a/lib/maple_tree.c~maple-tree-add-new-data-structure-fix-6 +++ a/lib/maple_tree.c @@ -5390,15 +5390,12 @@ unsigned char mas_dead_leaves(struct ma_ enum maple_type type; void *entry; int offset; + unsigned end = mas_data_end(mas); - for (offset = 0; offset < mt_slot_count(mas->node); offset++) { + for (offset = 0; offset <= end; offset++) { entry = mas_slot_locked(mas, slots, offset); type = mte_node_type(entry); node = mte_to_node(entry); - /* Use both node and type to catch LE & BE metadata */ - if (!node || !type) - break; - mte_set_node_dead(entry); smp_wmb(); /* Needed for RCU */ node->type = type; _ Patches currently in -mm which might be from liam.howlett@xxxxxxxxxx are android-binder-fix-lockdep-check-on-clearing-vma.patch maple-tree-add-new-data-structure-fix.patch maple-tree-add-new-data-structure-fix-2.patch maple-tree-add-new-data-structure-fix-3.patch maple-tree-add-new-data-structure-fix-4.patch maple-tree-add-new-data-structure-fix-5.patch maple-tree-add-new-data-structure-fix-6.patch lib-test_maple_tree-add-testing-for-maple-tree-fix.patch lib-test_maple_tree-add-testing-for-maple-tree-fix-2.patch lib-test_maple_tree-add-testing-for-maple-tree-fix-3.patch mm-mmap-change-do_brk_flags-to-expand-existing-vma-and-add-do_brk_munmap-fix.patch mm-mmap-use-advanced-maple-tree-api-for-mmap_region-fix.patch mm-remove-the-vma-linked-list-fix-3.patch mm-mlock-drop-dead-code-in-count_mm_mlocked_page_nr.patch