Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp907803rdg; Wed, 11 Oct 2023 08:43:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHlb33LM7HNBLqMXYvglz+R9mj6DUT51D0BZssfj0t0e9UCaH/cRg3+7sSLjYIXPtY7FSx7 X-Received: by 2002:a05:6358:5924:b0:135:24ed:5106 with SMTP id g36-20020a056358592400b0013524ed5106mr14443722rwf.9.1697039003339; Wed, 11 Oct 2023 08:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697039003; cv=none; d=google.com; s=arc-20160816; b=sBxFV8tivmiCDsMt7iTRUQRqFnxUhEruMgYexQAfD3W7xhh2EmV4P0pxQnkt+5+yPw dJ6xOmbiZU/+ioeXQGg3n73W6KqFJ7yftIsVUaY9NoDSWBMwh0+zLt1bTBtiPn3R17B3 iPs567GTm+u8HTXTWhxBgSWNpkUStEYzqOL7YV1QovT6e1fcGLxSNmmvJ2CYPIIoV0mU RCBznPkv+hMzYt4ZjQD09UR8+5G/D5AQIs58DpJUuijoCFoMhtYF7RNtDcdzVs5dD2zK hf/STis6v/PHlClyCHpQW9SjdvHNlO8+GvaF5avodslhkhAOMi8/H/CeOZNm6K8Dk+8O BxuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=cLH0umzVzkzMlLL505+WdiJ0FY1Sury7B+CiECVSeNs=; fh=vHAwAL0UPVEDZibr6b8xnLVcortqmbkxWO9knpUoC9M=; b=rQdSsRupLoI6eNBM616DHcZYEM4G9vFo1mjoZ+AdRQssDNs72Yb2AEo0AlgZXRKkl1 4z/IhWUzU1Rs7JJZ0+JmZ7c7/l0Pk0STpr2wgttXsC+7Kq03VprFLTF6b1cU+aXiK/95 7HAWLLPFABHasRg5WrY48K9SzcHVKHJhwl065PsRUEsy7W2vuu9TozIB/ZK/mVGapBze HOAw99Z1D85J7Y1yBmQWSIy7+ato0xM25HNt7AM6yBbXk3+s/qyKgt6u3FczP83Z2RHE i17sV9btUo0nH/cJnm/u98WCK3IdrxQrcOnW5gUXqOR7SzbvXMwNkIWhwwmumS77LrMC WJIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=NgbiRjYm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id b10-20020a056a000cca00b0069026a3de0asi12879509pfv.138.2023.10.11.08.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 08:43:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=NgbiRjYm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 2579E81552E5; Wed, 11 Oct 2023 08:43:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232714AbjJKPnE (ORCPT + 99 others); Wed, 11 Oct 2023 11:43:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232761AbjJKPnD (ORCPT ); Wed, 11 Oct 2023 11:43:03 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3DA691 for ; Wed, 11 Oct 2023 08:42:39 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c9d922c039so1820485ad.3 for ; Wed, 11 Oct 2023 08:42:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1697038959; x=1697643759; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=cLH0umzVzkzMlLL505+WdiJ0FY1Sury7B+CiECVSeNs=; b=NgbiRjYmhJ5Bk16WR5oC6CrM/U+56tmh0Pgr+rPI16qxlwBdEivylL2DtQxcnTTPme Se0kAfIKLqghW5gceJlHV4FYS9mDyWUwssLDwpEh84Z4GwV8EyqMiaAIC8w89p4EWaZy aFZl/g+ZP+ktOy6vNVVfDpiY+uEjvEiWWIEiCLbm4WA/+Bl54svT+chdsRFmiTFPqNPN 4eUNd0svrqpTLXJPbfktGpjR+lB3aSCDrN8Wy3xoYMJGZU005JBLsPGKcwmI2FzxW8kv e0dd+XpueecjdYRsRxvAlu5RA81zaI0BFcUIv/5Dp5iDjHa2QGG3jWGr+hgzCku7/nQV 2Upw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697038959; x=1697643759; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=cLH0umzVzkzMlLL505+WdiJ0FY1Sury7B+CiECVSeNs=; b=Dz++NvD9bYaUZw7YbddqwGtpVn0f91j9TGUFma0lFSMiP4PSbA8f+LjnpCYJnUH+Ch zHD9fDQHlxreC0kW68D7fnkRN8RvexhLKdW5tnQg0tMwH08iaZwdiukCEVQSDwXNp50P XrT98+3XUwObJPEH0P4iViU4msp2b4N1v7fHrNtPNBj5ZGVYp1YuSrHioFvZVI1NiWzM xG9irla38E8yf7gobUfEOk5hDu/WohXOcG7SklqOqOyBxptgv/fNwLHEDEGQ1iTZTYTH 1AzlLbdaFQ6Pdq6rKT5SM4ku9VL9JDCEa9OYjhNnsqwOyDN41n2xf621FAUYhROs3hGj yM3A== X-Gm-Message-State: AOJu0Yw2df4Z3s18hoMe8qXLOvzOFv7fe+jsdHIPvU0WtOratCNdomyQ EL5oNyoAzo/L+ZdZZXtJJWmsIQ== X-Received: by 2002:a17:902:7893:b0:1bc:6c8:cded with SMTP id q19-20020a170902789300b001bc06c8cdedmr20157796pll.67.1697038959247; Wed, 11 Oct 2023 08:42:39 -0700 (PDT) Received: from [10.4.181.228] ([139.177.225.227]) by smtp.gmail.com with ESMTPSA id g5-20020a170902c38500b001c60e7bf5besm14039387plg.281.2023.10.11.08.42.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Oct 2023 08:42:38 -0700 (PDT) Message-ID: <1632d0e6-2d52-43b1-8a01-056231c0819d@bytedance.com> Date: Wed, 11 Oct 2023 23:42:30 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 09/10] maple_tree: Preserve the tree attributes when destroying maple tree To: Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Peng Zhang , 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 References: <20231009090320.64565-1-zhangpeng.00@bytedance.com> <20231009090320.64565-10-zhangpeng.00@bytedance.com> From: Peng Zhang In-Reply-To: <20231009090320.64565-10-zhangpeng.00@bytedance.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 11 Oct 2023 08:43:10 -0700 (PDT) X-Spam-Level: ** 在 2023/10/9 17:03, Peng Zhang 写道: > 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 > --- > 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 d5544382ff15..1745242092fb 100644 > --- a/lib/maple_tree.c > +++ b/lib/maple_tree.c > @@ -6775,7 +6775,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)If I put everything into exit_mmap() for handling, this patch would not be necessary. But I think this patch is reasonable as it simply deletes all elements without requiring us to reinitialize the tree. What do you think? > } > EXPORT_SYMBOL_GPL(__mt_destroy); >