Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5588180rdb; Wed, 13 Dec 2023 13:09:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQzmyCg3hdDH0zt7blSRwjiSMeBTChrKnRA+xHYk1m0HYcE3EqUuvdAa0d1Cyg6B26d8DQ X-Received: by 2002:a17:903:2283:b0:1d0:45c6:1cc1 with SMTP id b3-20020a170903228300b001d045c61cc1mr10302412plh.27.1702501773601; Wed, 13 Dec 2023 13:09:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702501773; cv=none; d=google.com; s=arc-20160816; b=da0PkOa8Yi7QyRCNA0pal7UU5ZbkUIiVHxxAtnmtlSAqRYV3ZJFxGBjc3pD6AGJ2QO q62ql/U0FvIye/s4JhT2ZzDaFFA0GI/A9zP4XM0OMcGdPC8H1knnfEW+8Ukb9iJtroqN JT9Izj2LR1pHbuHoyPZKcBkZt3oC231F8MJcCaE0RJxQ2BXpznE/bgH5Vdaj0zD+S3N1 F6B1VjXzAgKeBdK2bBdwyHNyOZRe/nM+0bZijQ9i/q4wh0+dXHq33PbhWbCiK3/N6l0I UuQIKw06eSbpH5Kg5CaQTMrzjrYy8BFV+s+IdYpxvxWsutO4+XcQwe7tCIAcXflLY0mS 15eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=qDTugDj04n4n2PwLdy9KjD3ZYOuTHjwLWX4PrLg8RZA=; fh=fX4X7WoQmwvQriIrweiPyj8GklHW1s1o0mZzZwKl1vw=; b=FSgjW/Hb/w3JGubcEf6PGVTPwCpUGpQSR5IEy6Zof6EVVFChwOURq+Jd8lfzS26KqP cLeZX0N4LGzajJTVhpzqY49n8KtbnJmL47N/c/LIVZz1pR5Vh+cShwlXB1dg6INpHfMw X/kLu8XPWB7Q1/Qd4KUhRDggd4YsjI0lptn3D4jfs+9HcFcvkyfyKnxx9f3EndKwemYA psPgZOXHDTRUlYfBTAKjmGQihQVeeai4pfEuaHDupfc0v2y9gBe/oyw2KlxEXdMtNqEu aHCyLUQ/yUU6p90aCTz4PFeOJg6sFQCRCxZljuViK5NOp+3AsemFM4VzHwjGAkgfew1T iGTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=TxhwHSti; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id jw15-20020a170903278f00b001ca96a6eefesi10035273plb.577.2023.12.13.13.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 13:09:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=TxhwHSti; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3FDF9802C7C3; Wed, 13 Dec 2023 13:09:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442695AbjLMVJU (ORCPT + 99 others); Wed, 13 Dec 2023 16:09:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233987AbjLMVJS (ORCPT ); Wed, 13 Dec 2023 16:09:18 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D516E4 for ; Wed, 13 Dec 2023 13:09:25 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A876C433C8; Wed, 13 Dec 2023 21:09:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1702501764; bh=KvJdE+vcgyzrY9CE/Gn1fMHnjGdlBGiiEGOdz1tMHOo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TxhwHStiJ6vjUpNeQd6IktbzfLDlYCaZ9vCy/xQL+pIRycRkseI6XOharCy+N6fJs q7CdmxfSSbDv+QCOosKIiCRMYeJBWMvhfUsCrxtZLOlUOMUJo8xTDhjTNzGQYY461L yi8HAI7M+zYMHUZYf8sVog9ArE3wrFcp0t4lSdn4= Date: Wed, 13 Dec 2023 13:09:23 -0800 From: Andrew Morton To: Sidhartha Kumar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, maple-tree@lists.infradead.org, willy@infradead.org, liam.howlett@oracle.com, zhangpeng.00@bytedance.com, stable@vger.kernel.org Subject: Re: [PATCH V2] maple_tree: do not preallocate nodes for slot stores Message-Id: <20231213130923.cc00317b4ebab1b0864d8b42@linux-foundation.org> In-Reply-To: <31d24c29-5b7c-328c-b830-276acab43203@oracle.com> References: <20231213205058.386589-1-sidhartha.kumar@oracle.com> <31d24c29-5b7c-328c-b830-276acab43203@oracle.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 13:09:32 -0800 (PST) On Wed, 13 Dec 2023 13:03:29 -0800 Sidhartha Kumar wrote: > On 12/13/23 12:50 PM, Sidhartha Kumar wrote: > > mas_preallocate() defaults to requesting 1 node for preallocation and then > > ,depending on the type of store, will update the request variable. There > > isn't a check for a slot store type, so slot stores are preallocating the > > default 1 node. Slot stores do not require any additional nodes, so add a > > check for the slot store case that will bypass node_count_gfp(). Update > > the tests to reflect that slot stores do not require allocations. > > > > User visible effects of this bug include increased memory usage from the > > unneeded node that was allocated. > > > > Fixes: 0b8bb544b1a7 ("maple_tree: update mas_preallocate() testing") > > Cc: # 6.6+ > > Signed-off-by: Sidhartha Kumar > > --- > > v1->v2: > > fix coding style per Matthew and Andrew > > use wr_mas->node_end to fix build error > > > > When this is merged to mm-unstable could the following fixlet be applied to be > compatible with Liam's series[1]: > Yup, already on it. Liam's series is now in mm-stable so for now I'll leave a bisection hole. Maybe I'll fold it later if an mm-stable rebase/rebuild is needed, From: Andrew Morton Subject: lib/maple_tree.c: fix build error due to hotfix alteration Date: Wed Dec 13 12:59:49 PM PST 2023 Commit 0de56e38b307 ("maple_tree: use maple state end for write operations") was broken by a later patch "maple_tree: do not preallocate nodes for slot stores". But the later patch was scheduled ahead of 0de56e38b307, for 6.7-rc. This fixlet undoes the damage. Fixes: 0de56e38b307 ("maple_tree: use maple state end for write operations") Cc: Liam R. Howlett Cc: Sidhartha Kumar Signed-off-by: Andrew Morton --- lib/maple_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/lib/maple_tree.c~lib-maple_treec-fix-build-error-due-to-hotfix-alteration +++ a/lib/maple_tree.c @@ -5477,7 +5477,7 @@ int mas_preallocate(struct ma_state *mas node_size = mas_wr_new_end(&wr_mas); /* Slot store, does not require additional nodes */ - if (node_size == wr_mas.node_end) { + if (node_size == mas->end) { /* reuse node */ if (!mt_in_rcu(mas->tree)) return 0; _