From nobody Thu Dec 18 11:54:49 2025 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBCED28F938 for ; Thu, 10 Apr 2025 19:15:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744312507; cv=none; b=GoYPKGQ1ys1kRyK3KDwJfAbVTpDfD15MKaGmKL1OTL4PZ6x0VQ3PM85Y64puBgTJVo8DHeUBcnMULms/WxWeNE2UuYNSon2jDP0QDthF9UPRnCS0bTyXxHzoxyrEo+nYCQWqJbMLFwgwjBAsRfQ7hlwdcGsfiJaNZJueS6edyow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744312507; c=relaxed/simple; bh=5FmvgLwUgefF/15jQPZPuLOR7HLUsegiYz+SY3v7WMM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mO1LpKYnxa3oI68TDZ/lSv6AHaH0hW1SkrNTvbYmoG5RyHS/cuz3qlSSBPJLOWf93MqT/JkV82YysybBpT+w+MdEi7KSX3M7YyliyMR4Hu6i4oA4cLDQgsLZ9N0ZCFp6lx6bJpCSwk1BrhruCSnlAkpwOgG7QteUK1jqrqVir08= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=hRFyQ+uF; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="hRFyQ+uF" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 53AIH4ZK012989; Thu, 10 Apr 2025 19:14:54 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=xifEa GxLrCosb9AknfMROurmyL6jhk0BySHE36IGbs0=; b=hRFyQ+uF6NWCF7Hj3dR9L ICXRyfv0BPgx+0NVG/vKsxa+OE7cMzOody/1zxBtzDLqreW0LBPO3YLNOch5XCzB bmsgBq3F7Fkh1tjS8IzHk5pbFAn2MyYYKcdoCxU0HGzoZdr9MB1mc14uCJNuNxYc jSTbtwBGk+38iSNsBV40LOAvN08BoMNsLM+XNqaIxF9sGo1ZPqDWfWRojVJt+sT2 1DH0JXjF7fk6wnNPyqI1Sv2FCbcnHzQECW4kJHyvz3sA2L+81DsGTadOs7AS5QV6 txUQbqj+7Qu7X7K81OeZjqm0AbsLtAB2FlkSzMDJPuseaKtX99El2MLWlWV9ZvEA A== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 45xk4hr4qh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Apr 2025 19:14:54 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 53AIwiO4023934; Thu, 10 Apr 2025 19:14:53 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 45ttyk1ghq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Apr 2025 19:14:53 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 53AJEn8w040606; Thu, 10 Apr 2025 19:14:52 GMT Received: from sidhakum-ubuntu.osdevelopmeniad.oraclevcn.com (sidhakum-ubuntu.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.250.108]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 45ttyk1gg6-2; Thu, 10 Apr 2025 19:14:52 +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, willy@infradead.org, Sidhartha Kumar , "Liam R . Howlett" Subject: [PATCH v5 1/6] maple_tree: convert mas_prealloc_calc() to take in a maple write state Date: Thu, 10 Apr 2025 19:14:41 +0000 Message-ID: <20250410191446.2474640-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250410191446.2474640-1-sidhartha.kumar@oracle.com> References: <20250410191446.2474640-1-sidhartha.kumar@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-10_05,2025-04-10_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2502280000 definitions=main-2504100139 X-Proofpoint-GUID: lb46VRQHj5gIiT6ZeVph2vTkQyPfrviy X-Proofpoint-ORIG-GUID: lb46VRQHj5gIiT6ZeVph2vTkQyPfrviy Content-Type: text/plain; charset="utf-8" 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. There is no functional change. Reviewed-by: Liam R. Howlett 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 d0bea23fa4bc..f25ee210d495 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4140,13 +4140,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 *entr= y) { + struct ma_state *mas =3D wr_mas->mas; int ret =3D mas_mt_height(mas) * 3 + 1; =20 switch (mas->store_type) { @@ -4243,16 +4244,15 @@ static inline enum store_type mas_wr_store_type(str= uct ma_wr_state *wr_mas) */ static inline void mas_wr_preallocate(struct ma_wr_state *wr_mas, void *en= try) { - struct ma_state *mas =3D wr_mas->mas; int request; =20 mas_wr_prealloc_setup(wr_mas); - mas->store_type =3D mas_wr_store_type(wr_mas); - request =3D mas_prealloc_calc(mas, entry); + wr_mas->mas->store_type =3D mas_wr_store_type(wr_mas); + request =3D mas_prealloc_calc(wr_mas, entry); if (!request) return; =20 - mas_node_count(mas, request); + mas_node_count(wr_mas->mas, request); } =20 /** @@ -5397,7 +5397,7 @@ void *mas_store(struct ma_state *mas, void *entry) return wr_mas.content; } =20 - request =3D mas_prealloc_calc(mas, entry); + request =3D mas_prealloc_calc(&wr_mas, entry); if (!request) goto store; =20 @@ -5494,7 +5494,7 @@ int mas_preallocate(struct ma_state *mas, void *entry= , gfp_t gfp) =20 mas_wr_prealloc_setup(&wr_mas); mas->store_type =3D mas_wr_store_type(&wr_mas); - request =3D mas_prealloc_calc(mas, entry); + request =3D mas_prealloc_calc(&wr_mas, entry); if (!request) return ret; =20 --=20 2.43.0