From patchwork Thu Nov 14 17:05:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sid Kumar X-Patchwork-Id: 13875508 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 44CC5D68B3F for ; Thu, 14 Nov 2024 17:06:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B59A96B0083; Thu, 14 Nov 2024 12:06:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AE1D26B009D; Thu, 14 Nov 2024 12:06:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 95CD46B00AE; Thu, 14 Nov 2024 12:06:35 -0500 (EST) 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 71EB96B0083 for ; Thu, 14 Nov 2024 12:06:35 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 58322C125D for ; Thu, 14 Nov 2024 17:06:34 +0000 (UTC) X-FDA: 82785327030.09.BED1B44 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf04.hostedemail.com (Postfix) with ESMTP id 2DCF94033D for ; Thu, 14 Nov 2024 17:04:33 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=cLGVRprn; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf04.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731603843; 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=iPoSja3pKgizYaVyOF/YvV4XNpYb6HkD1dOoOPDQ6d4=; b=6g1un/kzxMPO+r7l0zFfS4elXFlrLUVOdEOr/leakHsyVfjV4yVkAGLLSkI8VVT7YMvahn ju9iAbyCV0krYgykrRn6inBZCfltEv83inAcMXUQmj4HH3g9N4hq4LsouNk7SHVjZRFGkD R42VvodCBmDRTb6SS2DEpEGpfZC5tjw= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=cLGVRprn; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf04.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731603843; a=rsa-sha256; cv=none; b=7xiiN8OxxBnW2pmoi9PeqUBzXsQ8V5VGX/3cw8HTCeCye9t20wGOxobeBkZ0+1j/juJ1NY nqk3xAVSGYNjDPTAouMZdiQhOg/DgtIVDN32IfxJz1FP0sN7IxPaGCOXpO1mUN4MynIaX5 LkUfdY805QrMTvYoLbs6SYMmb0UUUHI= Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AEChijk015748; Thu, 14 Nov 2024 17:05:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2023-11-20; bh=iPoSj a3pKgizYaVyOF/YvV4XNpYb6HkD1dOoOPDQ6d4=; b=cLGVRprnu/d6Wv7+rrIQs MGhWgFO8PnbqxVbdyQ7DxF2ScfBfznRxwZWRG8IIN1B+cvn3QAeRlJVxJeFC0Mm4 gR7/EQP1RrgwRWm4jdOHUPxAkGAy9CbPAEg0CdczprY+chvnG0UQ54M2qVHQDBFx DzNTM5UqjRHf2VBHcrjS17rGgGfDecDJ8kWW5AgR7WuSnByKV7LBQYPX2Wg6M419 n9OtMufXJ4wcRhH+mYeg+z8iO6LNYrPOAgDu40QO95/EE+wrIiAA/6EsZVAW+LHT e3qSCjxk30JZLVUKtKl4RzpNpV+n+VxFpzpLtWb/3vb/wROp22++Q4PZ4kYhZo2h Q== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0k29phn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Nov 2024 17:05:29 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4AEFZCp1022682; Thu, 14 Nov 2024 17:05:28 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42vuw1jy7e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Nov 2024 17:05:28 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 4AEH5QmJ032739; Thu, 14 Nov 2024 17:05:27 GMT Received: from sidkumar-mac.us.oracle.com (dhcp-10-39-201-66.vpn.oracle.com [10.39.201.66]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 42vuw1jy5w-2; Thu, 14 Nov 2024 17:05:27 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, liam.howlett@oracle.com, Sidhartha Kumar Subject: [PATCH 1/5] maple_tree: convert mas_prealloc_calc() to take in a maple write state Date: Thu, 14 Nov 2024 12:05:20 -0500 Message-ID: <20241114170524.64391-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241114170524.64391-1-sidhartha.kumar@oracle.com> References: <20241114170524.64391-1-sidhartha.kumar@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-14_05,2024-11-13_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 spamscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411140134 X-Proofpoint-ORIG-GUID: Pi8ej0-RcmxcKFwAiABK4IAlpu_VRTgd X-Proofpoint-GUID: Pi8ej0-RcmxcKFwAiABK4IAlpu_VRTgd X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 2DCF94033D X-Stat-Signature: rz3ksyben81gnepanz7yy9wtifrnysnd X-HE-Tag: 1731603873-397993 X-HE-Meta: U2FsdGVkX19UaSJowNn8x0VYOYkUaIoGZHTvUCLQVlZthpvlgbZYm+3MUNLPNu9WbNMssEcaLXZuMPJYkrqQqrVipzhuCPGmGV6nANA2Alhs+eDiuMm+VFeG7jaDbHw2Kq4qEwgTnmjMH4Nrm0QOB87l2IjBKkGdl2r9tYaYeSBwt2Y9IJ0UxhJy34zNLEmUC8G6j2z4EGshj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ity: 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: In a subsequent patch, mas_prealloc_calc() will need to access fields only in the ma_wr_state. Convert the function to take in a ma_wr_state and modify all callers. Signed-off-by: Sidhartha Kumar --- lib/maple_tree.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index d0ae808f3a14..318d496debd7 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4155,13 +4155,14 @@ static inline void mas_wr_prealloc_setup(struct ma_wr_state *wr_mas) /** * mas_prealloc_calc() - Calculate number of nodes needed for a * given store oepration - * @mas: The maple state + * @wr_mas: The maple write state * @entry: The entry to store into the tree * * Return: Number of nodes required for preallocation. */ -static inline int mas_prealloc_calc(struct ma_state *mas, void *entry) +static inline int mas_prealloc_calc(struct ma_wr_state *wr_mas, void *entry) { + struct ma_state *mas = wr_mas->mas; int ret = mas_mt_height(mas) * 3 + 1; switch (mas->store_type) { @@ -4258,16 +4259,15 @@ static inline enum store_type mas_wr_store_type(struct ma_wr_state *wr_mas) */ static inline void mas_wr_preallocate(struct ma_wr_state *wr_mas, void *entry) { - struct ma_state *mas = wr_mas->mas; int request; mas_wr_prealloc_setup(wr_mas); - mas->store_type = mas_wr_store_type(wr_mas); - request = mas_prealloc_calc(mas, entry); + wr_mas->mas->store_type = mas_wr_store_type(wr_mas); + request = mas_prealloc_calc(wr_mas, entry); if (!request) return; - mas_node_count(mas, request); + mas_node_count(wr_mas->mas, request); } /** @@ -5441,7 +5441,7 @@ void *mas_store(struct ma_state *mas, void *entry) return wr_mas.content; } - request = mas_prealloc_calc(mas, entry); + request = mas_prealloc_calc(&wr_mas, entry); if (!request) goto store; @@ -5538,7 +5538,7 @@ int mas_preallocate(struct ma_state *mas, void *entry, gfp_t gfp) mas_wr_prealloc_setup(&wr_mas); mas->store_type = mas_wr_store_type(&wr_mas); - request = mas_prealloc_calc(mas, entry); + request = mas_prealloc_calc(&wr_mas, entry); if (!request) return ret;