Commit 3d73aa91 authored by Peng Zhang's avatar Peng Zhang Committed by Peng Zhang
Browse files

maple_tree: preserve the tree attributes when destroying maple tree

mainline inclusion
from mainline-v6.8-rc1
commit 8e50d32c7a89bde896945e4e572ef28ccd87bbf8
category: performance
bugzilla: https://gitee.com/openeuler/kernel/issues/I9AYM3
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8e50d32c7a89bde896945e4e572ef28ccd87bbf8

--------------------------------

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: default avatarPeng Zhang <zhangpeng.00@bytedance.com>
Reviewed-by: default avatarLiam R. Howlett <Liam.Howlett@oracle.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Mateusz Guzik <mjguzik@gmail.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Mike Christie <michael.christie@oracle.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
parent b7c4d1e1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);