From mboxrd@z Thu Jan 1 00:00:00 1970 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 E21C5C4332F for ; Wed, 13 Dec 2023 21:09:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 636A28D005B; Wed, 13 Dec 2023 16:09:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5BD548D0049; Wed, 13 Dec 2023 16:09:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45DE68D005B; Wed, 13 Dec 2023 16:09:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 31B098D0049 for ; Wed, 13 Dec 2023 16:09:28 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E9F2BA0BEA for ; Wed, 13 Dec 2023 21:09:27 +0000 (UTC) X-FDA: 81563035974.09.5FE5C8D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf24.hostedemail.com (Postfix) with ESMTP id 3F78E180020 for ; Wed, 13 Dec 2023 21:09:26 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=TxhwHSti; dmarc=none; spf=pass (imf24.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702501766; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qDTugDj04n4n2PwLdy9KjD3ZYOuTHjwLWX4PrLg8RZA=; b=ZEo4q3YrzdHWyaf/Nb2TpOhJJy+OMHwPoY1ADLJJnqJJrW3v/lM4zfzaM+S5t4ctMoi02v 9xjJYtUMDBwDS2Gy8bTwpKpBDapiJ8Es5ZhkxMBo2rTw9MhnUSPsQToOsiwUj97+SEkPwR KDbXF6EglPrEHo2XYR2jBzaAMRT1YyY= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=TxhwHSti; dmarc=none; spf=pass (imf24.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702501766; a=rsa-sha256; cv=none; b=1aG3DQUS9MF+mHUucQsZyoYPJ1u2DV8/XIMJojbtIPl6UOEky8gy+0Wg9Xnpj69HS/cM0i xA20k3NffLiKlKTZ7c9eQjepwsKxaQ8huaRS9Nw3eBmcVrtc7BYEIULjQE8idyTecgNs/M rLAt3RRmXEtqwagrMSnPjx8wTCwRluI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0EC8361F9A; Wed, 13 Dec 2023 21:09:25 +0000 (UTC) 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-Rspam-User: X-Stat-Signature: aq8prouugqnuqbs4czihthjnbgt3bqet X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3F78E180020 X-HE-Tag: 1702501766-573030 X-HE-Meta: U2FsdGVkX18SC7xSsw94p6rjRHAoL1VHfACK+8WnR4w6Jymxl6y/vpENCKl3WPSyN9kPoQqXolyQRluJ//cQs12QNfmSrqbvpGsJ8N27dOEA/rMDIEEea9PfSc8X0+XHtenBfUOjllAolFaGiA72jQKYrWYWXGKDSw9p9UIpgysVNf94ZsuGlJuv84TgvBtwdJ8fOBkOGwmmzw8+pI7NYSje0dCIKt7UduTbilSVP8OGPJuoXgs3Sn5mBJhf88SvyxgFlTAMZqwRtFKQQuf80qQ6+mF9KqOFLrra2ep6QtxIghLKtPcqrn/hYoxe46muPapCVmdJtglFe6vJvtfhLR3KvSGk+Ky7D+L9SxhEy9HfocQ5rkAKo376IWTU6PFyEoKZJc+n/P2eazeP9LzeeT+T24Mt1ybsUk1xHJ4WH7Bufipph1qfhqfJouypnL/e58mJ0SzwFCpOs8awA0rycdX7ATHGq2qrFZ8e89WPFMC0M0nUdJV+0+XOuhznY0QV3vmEMqShH/h5qYBCFGJME4QLMrQNP2PkjKgC5Tc+BdXc7tSr5F1GCaHQx/5wQ3R4LncHnnpIEOF6iQ/y0LeeSnrw9BHvlnePZq/n8JRZs/TFgmSmAH+2t+bvweGAeu78HEpbA/P0BW/Beqmw6UtQAyKhCuuvxgmEA/V2Qu3JsfoRuhJvP+WZWS/85lOfXZ2u0LP1ruascD2vevvV6XrhqWk1jMcnLqIClsjxL+YPi/9mOogleSH1dK2uyy01/Z1huznl7dvBOFMy0EGI0VzcrRRU4Qujc+bvfIDm781mrmNsTmlW33N8uYgkiI7NjeCxaa72Yjg1cj9aCW7qNxJpvPW9GtI1AFWRYkFeW+eXMBv+O9w/veVGqFz8khQKo07CKApy+AfnMAJnrJQT+wKlG3FLqQS5Bk3VvyBgdoy6dGNXFaI7I1GlmuH0kbtvY3biQD77CzDlbdmjMgC7MVB HdCMHtoL AVB321fEnLevPLbnD3fliKGrFEaYyS2tkSDP/IZiFQdJkaErF81y0lLJC4KDAvyLjDldn1re6CHHLhvXuJ79Qhvo164IjOgtUcd2cNLjGdEcD3iRoJmbCSVIn1pA2Gwhky7AxjIAdussXd9NE41Ete9P6rLFfyyoAkhJ+C0iP6ivDxSb1eo3rsNPwf6RQfGaLzRcdLluzAhNyGL5HSHw9orX5ECH64EM5X8DCJ3IAa0wE1aXYskmCSBBslFRX3cc1MSXi33DlhGxI1VDxVz0F1mofnTz9HQjCHLGq2qElh0uAB3izji/5NRIztTuhagXhOLgFwbG/09ry+18MjhHRSAfnLFVWESCOMLY34XV3k8BzGswgkOuYFGYMOFW3OsnL1BW3fSozLd8jaV5KYvGqHPUlPb6hiezBwpqPvl6rvBSUx8RJv+sOyUTshU+65xU6mtTP 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: 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; _