From 3743b40f655249489c00b52a1481f789eba2f4bb Mon Sep 17 00:00:00 2001 From: Peng Zhang Date: Fri, 27 Oct 2023 11:38:44 +0800 Subject: [PATCH] FROMGIT: maple_tree: preserve the tree attributes when destroying maple tree 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 Reviewed-by: Liam R. Howlett Cc: Christian Brauner Cc: Jonathan Corbet Cc: Mateusz Guzik Cc: Mathieu Desnoyers Cc: Matthew Wilcox Cc: Michael S. Tsirkin Cc: Mike Christie Cc: Nicholas Piggin Cc: Peter Zijlstra Cc: Suren Baghdasaryan Signed-off-by: Andrew Morton (cherry picked from commit 8e50d32c7a89bde896945e4e572ef28ccd87bbf8 https://git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-unstable) Bug: 308042511 Change-Id: If1725d5a37dcd26bec23e6bffe95d877903dfab1 Signed-off-by: Suren Baghdasaryan --- 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 3bc5414f78ab..1200ff73c1b0 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -6825,7 +6825,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);