From patchwork Fri Oct 27 03:38:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13438102 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00B89C25B47 for ; Fri, 27 Oct 2023 03:40:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E3746B0397; Thu, 26 Oct 2023 23:40:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 891706B0398; Thu, 26 Oct 2023 23:40:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 780F06B0399; Thu, 26 Oct 2023 23:40:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 68ED66B0397 for ; Thu, 26 Oct 2023 23:40:11 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3E15040F95 for ; Fri, 27 Oct 2023 03:40:11 +0000 (UTC) X-FDA: 81389838222.08.4598CA5 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf20.hostedemail.com (Postfix) with ESMTP id 6E5961C0005 for ; Fri, 27 Oct 2023 03:40:09 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=FVzhXTmN; spf=pass (imf20.hostedemail.com: domain of zhangpeng.00@bytedance.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=zhangpeng.00@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698378009; a=rsa-sha256; cv=none; b=7e8Tav6ZzO7DxSUNnfn4sB8fGYI/Gj7oMWPtbrPeGYTDmE6YPy+irXL7kI2hqbPK5uunGt z3VKt0+RQyPHzZZzi+DRnHeiEJGrUD2hyc19A6gY9DvOaD1L/lmDWxwziOFG74mDzD4ItZ utziw7jBGWwcKWUR9Vzf8gxP0i77z8w= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=FVzhXTmN; spf=pass (imf20.hostedemail.com: domain of zhangpeng.00@bytedance.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=zhangpeng.00@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698378009; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=t/TBSsqo/3PZG//kKjzBxqBhIhs+Qitm7vuazfD4aPI=; b=uL5e9PaO2a4Sl2uS03bU1CJs7NI3P6uR6PvpR9K0rdJV/g2evepazm3PHSOChY9YIHT1Om S08G1LtoebruliWPBllbAoiOr9bSnK+67gZA/i9oSWv0VRX/qv+8FbUfVDSSVtIUvuZPx5 dHipALHqvZblSw/5XaAMfNIl89lx6eI= Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-27dc1e4d8b6so1367986a91.0 for ; Thu, 26 Oct 2023 20:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1698378008; x=1698982808; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t/TBSsqo/3PZG//kKjzBxqBhIhs+Qitm7vuazfD4aPI=; b=FVzhXTmNpfK/YafHOxlklyWhwmOdZ8KmVRZ/mrLnDnrLfU3V/YGeFGRhImqQtIFtqq +lKKz/5SOOVExPTLvP0v46wWD04S+eBX8yOsuKDRhPQoO3grLaorNVpsfGVdXL1eQ4C7 kyl/wEUd4xPcPFfAnTfNTofXSxWvvSXCRMVbD3VcpNolbfWTfjfgbCkTo/mLilzRjxbd 3OJZ9Sv2AUEVLyE0OPqgPr4OfKDtas/t3Nec4dKoYjS3tk5LIJ5snDuF2A7tNjNueb0g H0rXV8OAP2LwoO34n+byBIzVXK+nUMmyOe+3Rz8dSd39nYb1wkOWYPv0pOl9GV3Z0Eg6 Zq9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698378008; x=1698982808; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t/TBSsqo/3PZG//kKjzBxqBhIhs+Qitm7vuazfD4aPI=; b=tumIBhdPM6i+L70FdosqydA5nW+JI5n0yfbHBZPL3qs4jkG+6xltUotZS840LuF/HK mrJFi4nGSo8Yt9W08iefo8u+8o9qpIXIJX3OjFxvJKk4QXgZKQ/vs4CZn28Xzt8yWP/P h3bexXGEKSBQryYofUONEoKn/cFF46G5pRGij0C3T77HGbq46iCt1ZtA9S4d5DW8qcO2 V4e1EAeXxgf5Jlm7LyBUVn+jA4OQrhOAdu1o+DYNkiLHpn/QQGOEm3N24jir3J9nRTxy LooR3+N3Qeo6KdPeX3+SpJAKrIMZXlfR7e3SEO0QVMwDC387EJKGByqkWw0EqL+CnEGc oB8g== X-Gm-Message-State: AOJu0Yza+OErrCZnu0voCOfB2dxugewhAC/+CMqHiajXNvKAK7407wHV bAh/dx6M/mZ6k79hh5KCo/vj+w== X-Google-Smtp-Source: AGHT+IExlg2G7fYOUnFWtBHLrBsW1lyYgFaUWIXf6NstZ6E0c++iEGcYR48s2/F7tPuX752NBLahNg== X-Received: by 2002:a17:90b:18e:b0:27d:2663:c5f4 with SMTP id t14-20020a17090b018e00b0027d2663c5f4mr1538778pjs.47.1698378008501; Thu, 26 Oct 2023 20:40:08 -0700 (PDT) Received: from GL4FX4PXWL.bytedance.net ([203.208.189.7]) by smtp.gmail.com with ESMTPSA id ms19-20020a17090b235300b00267d9f4d340sm2345676pjb.44.2023.10.26.20.40.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 26 Oct 2023 20:40:08 -0700 (PDT) From: Peng Zhang To: Liam.Howlett@oracle.com, corbet@lwn.net, akpm@linux-foundation.org, willy@infradead.org, brauner@kernel.org, surenb@google.com, michael.christie@oracle.com, mjguzik@gmail.com, mathieu.desnoyers@efficios.com, npiggin@gmail.com, peterz@infradead.org, oliver.sang@intel.com, mst@redhat.com Cc: zhangpeng.00@bytedance.com, maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 09/10] maple_tree: Preserve the tree attributes when destroying maple tree Date: Fri, 27 Oct 2023 11:38:44 +0800 Message-Id: <20231027033845.90608-10-zhangpeng.00@bytedance.com> X-Mailer: git-send-email 2.39.3 (Apple Git-145) In-Reply-To: <20231027033845.90608-1-zhangpeng.00@bytedance.com> References: <20231027033845.90608-1-zhangpeng.00@bytedance.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 6E5961C0005 X-Stat-Signature: qp96ixi78h397o3qx3oidpnwkhoowe33 X-Rspam-User: X-HE-Tag: 1698378009-346311 X-HE-Meta: U2FsdGVkX19GAfTQHKZr7px3Lr3HfBAKPxM4191mWGYJAIbiaGHtKPdZ9+pY2ly8IfOuoTa0Kq8aVn+QVPdAttLOr8txirL6R5tY826Wi0Iwpp3G3bijmWjQ8VpjvFuYLyYS/OG7vTrLrnIIN73quXQib3G5uF0I/ju5/hor4a0xFJykzTtFrTkTJv+TM4FRqXzmprjfPdeucle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breybRzLt1NHzd25NcEq0cMBH4YETsM+wqu0ca9a4qDeuRRQ0wgtHO0Hv/y88cxRHetx9dVUcU5GpP6vXWowEMEOWdNJTwDtrIyBsC94xR5iInXVknVpyLapin8ptv78190rQrvCp9HxEhfYKZz2xLhF7qeTRgi7HUxu3EaGFAlwjcqQy9kCXNJvnwX3fgdeQ/Z+0642in4tM= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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. Signed-off-by: Peng Zhang Reviewed-by: Liam R. Howlett --- 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 718a222cc090..4439469442c7 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -6763,7 +6763,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);