Message ID | 20240814161944.55347-7-sidhartha.kumar@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 4FFFAC531DC for <linux-mm@archiver.kernel.org>; Wed, 14 Aug 2024 16:20:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 505166B00A3; Wed, 14 Aug 2024 12:20:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B4646B00A4; Wed, 14 Aug 2024 12:20:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32F956B00A5; Wed, 14 Aug 2024 12:20:11 -0400 (EDT) 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 115826B00A3 for <linux-mm@kvack.org>; Wed, 14 Aug 2024 12:20:11 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 357DFC105B for <linux-mm@kvack.org>; Wed, 14 Aug 2024 16:20:09 +0000 (UTC) X-FDA: 82451362938.03.8632D2D Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf17.hostedemail.com (Postfix) with ESMTP id 137D640032 for <linux-mm@kvack.org>; Wed, 14 Aug 2024 16:20:06 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=EArQVfEA; spf=pass (imf17.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723652311; 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=F6//Jvlc/D0rvk43vXh/wiNs1SFnxWF+1gX4poKKCEk=; b=IQ3J6I5blCjVxQ5FFTUC2GFLEzlixcEeTyAIDl54zzACe1Ax3TClp5N6MF/ypsApNMd7NE cnY74EjYH1vl1g+rDBhG/ulggJSXRwDukzC8KeqaM+PBbyPxT64SzQYo3Z7/yq6PvSEfah iyEZxnptBbov5QvyvDCbDeXM1vHHNOA= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=EArQVfEA; spf=pass (imf17.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723652311; a=rsa-sha256; cv=none; b=Ue2cyGSTx1pZU9jY8xXzKN8QdKxfCyt2EJSY8BybcWWtAjoGUYJ4c8OmuANouSdnBy9jZZ 2ttz+la/BzaZasx8zH+R63j5y5oAJ4Fjlc2IHqXupbPMhzXurlWJsCpbDwJT6XBfInDVta 1hBeBCqrtshfQlLCYr6kpDq8GYI6lH4= Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47EBtcGx006145; Wed, 14 Aug 2024 16:19:55 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=F 6//Jvlc/D0rvk43vXh/wiNs1SFnxWF+1gX4poKKCEk=; b=EArQVfEALrEoJo2oM TigFy7GcqqR6qe/rMjdeX7uZtN/u7IthiZ/k8iyweor+C8RN1oPFzzHv0MMJADfC QWbmKxp28rUv1lxJ0Xlaiyact4Xd73fcE1F3U/9HR9/nQnuZWQkH7kTdgSJYZvUE yI/3VXYIneYdxAeFtcgCjXEcB0B5zcH7Gyo3fYcyo2kBt0czoCKx7g+hnH55jBiE PIotWrUKfJwt0UDN54h+s3wPWlXsewI5GDbsNIUF8HySb5xLllmfXhUzAtea73VP +AYbc80574IrKeizuPa4TXJOQFWUG+dMGHzC45bg1BexChT4FQXhVnz85ssELssf o/Kwg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40wy4bgub2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Aug 2024 16:19:54 +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 47EFePwq020583; Wed, 14 Aug 2024 16:19:53 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40wxngn7ng-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Aug 2024 16:19:53 +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 47EGIvC8035951; Wed, 14 Aug 2024 16:19:52 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-7; Wed, 14 Aug 2024 16:19:52 +0000 From: Sidhartha Kumar <sidhartha.kumar@oracle.com> 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 <sidhartha.kumar@oracle.com> Subject: [PATCH v4 06/17] maple_tree: preallocate nodes in mas_erase() Date: Wed, 14 Aug 2024 12:19:33 -0400 Message-ID: <20240814161944.55347-7-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> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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-GUID: 4IOsR78Mk9VBiSAdzsFvMZEOU7qiZRxQ X-Proofpoint-ORIG-GUID: 4IOsR78Mk9VBiSAdzsFvMZEOU7qiZRxQ X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 137D640032 X-Stat-Signature: ycpcqkutxtffzuwpayaoqso1bqnst897 X-Rspam-User: X-HE-Tag: 1723652406-598463 X-HE-Meta: U2FsdGVkX19TJiDO0dTd9c9/H+sXnLhSF+JpQ1n3l9Yn+tyxdhtiTs/Bl39rgWXJqojXO17yb//eKETS84qEF3fTpYghZ+euDwRRHibNDUiSWgZj8+vi387MnbT5BfLcy+dh2FcT7OuQ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E87bxAZfsnjld73V3G02T4hZN/PVc0= 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Introduce a store type enum for the Maple tree
|
expand
|
diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 58985107cf00..8ba52ffa778e 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -6371,14 +6371,18 @@ void *mas_erase(struct ma_state *mas) /* Must reset to ensure spanning writes of last slot are detected */ mas_reset(mas); - mas_wr_store_setup(&wr_mas); - mas_wr_store_entry(&wr_mas); + mas_wr_preallocate(&wr_mas, NULL); if (mas_nomem(mas, GFP_KERNEL)) { /* in case the range of entry changed when unlocked */ mas->index = mas->last = index; goto write_retry; } + if (mas_is_err(mas)) + goto out; + + mas_wr_store_entry(&wr_mas); +out: mas_destroy(mas); return entry; }
Use mas_wr_preallocate() in mas_erase() to preallocate enough nodes to complete the erase. Add error handling by skipping the store if the preallocation lead to some error besides no memory. Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com> --- lib/maple_tree.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)