diff options
author | 2023-12-20 14:47:18 -0800 | |
---|---|---|
committer | 2023-12-20 14:47:18 -0800 | |
commit | a721aeac8bc2cade37e68ea195f28d2ed28c1130 (patch) | |
tree | 34da931ad1d0d715c4fde89d19af67780e40a6aa /lib/maple_tree.c | |
parent | maple_tree: change return type of mas_split_final_node as void. (diff) | |
parent | mailmap: add an old address for Naoya Horiguchi (diff) | |
download | linux-rng-a721aeac8bc2cade37e68ea195f28d2ed28c1130.tar.xz linux-rng-a721aeac8bc2cade37e68ea195f28d2ed28c1130.zip |
sync mm-stable with mm-hotfixes-stable to pick up depended-upon changes
Diffstat (limited to 'lib/maple_tree.c')
-rw-r--r-- | lib/maple_tree.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/maple_tree.c b/lib/maple_tree.c index dc1f45b1628d..d30815cbab80 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5475,6 +5475,17 @@ int mas_preallocate(struct ma_state *mas, void *entry, gfp_t gfp) mas_wr_end_piv(&wr_mas); node_size = mas_wr_new_end(&wr_mas); + + /* Slot store, does not require additional nodes */ + if (node_size == wr_mas.node_end) { + /* reuse node */ + if (!mt_in_rcu(mas->tree)) + return 0; + /* shifting boundary */ + if (wr_mas.offset_end - mas->offset == 1) + return 0; + } + if (node_size >= mt_slots[wr_mas.type]) { /* Split, worst case for now. */ request = 1 + mas_mt_height(mas) * 2; |