[PATCH 6.6 05/28] maple_tree: preserve the tree attributes when destroying maple tree

Yu Kuai yukuai1 at huaweicloud.com
Thu Oct 24 13:19:46 UTC 2024


From: Peng Zhang <zhangpeng.00 at bytedance.com>

commit 8e50d32c7a89bde896945e4e572ef28ccd87bbf8 upstream.

When destroying maple tree, preserve its attributes and then turn it into
an empty tree.  This allows it to be reused without needing to be
reinitialized.

Link: https://lkml.kernel.org/r/20231027033845.90608-10-zhangpeng.00@bytedance.com
Signed-off-by: Peng Zhang <zhangpeng.00 at bytedance.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett at oracle.com>
Cc: Christian Brauner <brauner at kernel.org>
Cc: Jonathan Corbet <corbet at lwn.net>
Cc: Mateusz Guzik <mjguzik at gmail.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Cc: Matthew Wilcox <willy at infradead.org>
Cc: Michael S. Tsirkin <mst at redhat.com>
Cc: Mike Christie <michael.christie at oracle.com>
Cc: Nicholas Piggin <npiggin at gmail.com>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Suren Baghdasaryan <surenb at google.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Yu Kuai <yukuai3 at huawei.com>
---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 6f1addbbc820..97a610307d38 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -6774,7 +6774,7 @@ void __mt_destroy(struct maple_tree *mt)
 	if (xa_is_node(root))
 		mte_destroy_walk(root, mt);
 
-	mt->ma_flags = 0;
+	mt->ma_flags = mt_attr(mt);
 }
 EXPORT_SYMBOL_GPL(__mt_destroy);
 
-- 
2.39.2



More information about the amd-gfx mailing list