FROMLIST: maple_tree: Adjust node allocation on mas_rebalance()

mas_rebalance() is called to rebalance an insufficient node into a
single node or two sufficient nodes.  The preallocation estimate is
always too many in this case as the height of the tree will never grow
and there is no possibility to have a three way split in this case, so
revise the node allocation count.

Change-Id: I04ba0674da381c06d4f8077f9f59d64b7d1a8312
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Link: https://lore.kernel.org/all/20230612203953.2093911-9-Liam.Howlett@oracle.com/
Bug: 274059236
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
Liam R. Howlett 2023-06-12 16:39:45 -04:00 committed by Treehugger Robot
parent e835ffdfbc
commit 8f5a220975

View file

@ -3189,7 +3189,7 @@ static inline int mas_rebalance(struct ma_state *mas,
* tries to combine the data in the same way. If one node contains the
* entire range of the tree, then that node is used as a new root node.
*/
mas_node_count(mas, 1 + empty_count * 3);
mas_node_count(mas, empty_count * 2 - 1);
if (mas_is_err(mas))
return 0;