From nobody Thu Dec 18 22:14:53 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 EF02F1B9B3C for ; Wed, 14 Aug 2024 16:20:13 +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=1723652415; cv=none; b=PGRn02yoegBYFma+5p12S1KssFUd/5n8Qk2OJ0p0QpB2Gy7TwxZ8+8csjTT/uewuuQVGLJQmgUpw6Dgvy/Y+FC0E0g3qJlE7jfimIAlxVh3BGpyvoITSIe0CTH4YryYtx4Fy4k2fyVp4XF8g6WV7UrAZGrNkoG/9ui/gWgjrkT8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723652415; c=relaxed/simple; bh=1yoUNY7DTW85jlaiPfi1XkItvPk2JIpfkugPcqXmdjc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K06uLBS10cxa1NV9mYm2+TVHZX2HhRDE5fD+Tn/EDntnIlzJU82OCRtvM6PQ0DYTQDAadGhAy1Zg7uuhaCYgyBZe6mZcgQr6AS6ZH2QDZ/MT/sB3qXPf2P3v+vi9MZsPrkFa+WTKwNdGokepP3FMqBoqpl7/EPwu24WlI1OxTOE= 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=kFcyucQ8; 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="kFcyucQ8" 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 47EBtZgV003682; Wed, 14 Aug 2024 16:20:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=M sIb3HZBRJKwKbgYNU47zxkFCp/jEGMVccONsMnaDqQ=; b=kFcyucQ8YVhlqm/2e zLjQRFH9KwcsHSgLIgXgtc4cUi8xnXaqO+GOQP3xWAqTOGT2BwjwgK5zxMMD9/WL Rl6ZCQx+F84vjdWCydHhOBdrpb4K5pf5yU0hm25LoafxuUN+O1Ik71KlLnhKtgha 04CcRkqS9SYPpLMcHbWOrnVZhfc0OEhslUCpi+bZ0LNTyqWvLuLDavRZGdmFso40 IyhbVxDR0nKV0s3uTInOCkPoRd9wkbZu0TxnafgDiAdCTHTN2NMB+sYeyyJ4pK+K Ge1fQaPzpYNfaH9F8t1q19tj5nyySR1qkAdnC6slVx/tLp8h8oVgW225htMniquQ aKBNg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40wxmd0n6c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Aug 2024 16:20:00 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 47EGCmUl020856; Wed, 14 Aug 2024 16:20:00 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40wxngn7ug-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Aug 2024 16:20:00 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47EGIvCS035951; Wed, 14 Aug 2024 16:19:59 GMT Received: from sidkumar-mac.us.oracle.com (dhcp-10-65-174-212.vpn.oracle.com [10.65.174.212]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 40wxngn7gt-17; Wed, 14 Aug 2024 16:19:59 +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, surenb@google.com, Sidhartha Kumar , "Liam R. Howlett" Subject: [PATCH v4 16/17] maple_tree: remove unneeded mas_wr_walk() in mas_store_prealloc() Date: Wed, 14 Aug 2024 12:19:43 -0400 Message-ID: <20240814161944.55347-17-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240814161944.55347-1-sidhartha.kumar@oracle.com> References: <20240814161944.55347-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.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-14_12,2024-08-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 bulkscore=0 phishscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408140111 X-Proofpoint-ORIG-GUID: EDX0ewiXBofFrXhqkQ4euxapwsLPtcCk X-Proofpoint-GUID: EDX0ewiXBofFrXhqkQ4euxapwsLPtcCk Content-Type: text/plain; charset="utf-8" Users of mas_store_prealloc() enter this function with nodes already preallocated. This means the store type must be already set. We can then remove the call to mas_wr_store_type() and initialize the write state to continue the partial walk that was done when determining the store type. Reviewed-by: Liam R. Howlett Signed-off-by: Sidhartha Kumar --- lib/maple_tree.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 8c1a1a483395..73ce63d9c3a0 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3979,9 +3979,6 @@ static inline void mas_wr_end_piv(struct ma_wr_state = *wr_mas) wr_mas->end_piv =3D wr_mas->pivots[wr_mas->offset_end]; else wr_mas->end_piv =3D wr_mas->mas->max; - - if (!wr_mas->entry) - mas_wr_extend_null(wr_mas); } =20 static inline unsigned char mas_wr_new_end(struct ma_wr_state *wr_mas) @@ -5532,8 +5529,19 @@ void mas_store_prealloc(struct ma_state *mas, void *= entry) { MA_WR_STATE(wr_mas, mas, entry); =20 - mas_wr_prealloc_setup(&wr_mas); - mas_wr_store_type(&wr_mas); + if (mas->store_type =3D=3D wr_store_root) { + mas_wr_prealloc_setup(&wr_mas); + goto store; + } + + mas_wr_walk_descend(&wr_mas); + if (mas->store_type !=3D wr_spanning_store) { + /* set wr_mas->content to current slot */ + wr_mas.content =3D mas_slot_locked(mas, wr_mas.slots, mas->offset); + mas_wr_end_piv(&wr_mas); + } + +store: trace_ma_write(__func__, mas, 0, entry); mas_wr_store_entry(&wr_mas); MAS_WR_BUG_ON(&wr_mas, mas_is_err(mas)); --=20 2.46.0