]> www.infradead.org Git - users/jedix/linux-maple.git/commit
maple_tree: mtree_range_walk() clean up
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 1 Nov 2023 17:16:29 +0000 (13:16 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 20 Nov 2023 21:16:24 +0000 (13:16 -0800)
commit4c0328facc1fa4bb7472b9fca60650e58c5e041f
tree3b17fbed8141d5703338f744d1f21ac8bd2270bf
parent763b2c97d00783e0813987b49eb2d664a2490c10
maple_tree: mtree_range_walk() clean up

mtree_range_walk() needed to be updated to avoid checking if there was a
pivot value.  On closer examination, the code could avoid setting min or
max in certain scenarios.  The commit removes the extra check for
pivot[offset] before setting max and only sets max when necessary.  It
also only sets min if it is necessary by checking offset 0 prior to the
loop (as it has always done).

The commit also drops a dead node check since the end of the node will
return the array size when the last slot is occupied (by a potential reuse
in a dead node).  The data will be discarded later if the node is marked
dead.

Benchmarking these changes results in an increase in performance of 5.45%
using the BENCH_WALK in the maple tree test code.

Link: https://lkml.kernel.org/r/20231101171629.3612299-13-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/maple_tree.c