From patchwork Tue Jun 4 17:41:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13685751 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 4468BC25B78 for ; Tue, 4 Jun 2024 18:39:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 914026B007B; Tue, 4 Jun 2024 14:39:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C3536B0098; Tue, 4 Jun 2024 14:39:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 715C06B0099; Tue, 4 Jun 2024 14:39:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 525BF6B0098 for ; Tue, 4 Jun 2024 14:39:29 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id DB6B51604E9 for ; Tue, 4 Jun 2024 18:39:28 +0000 (UTC) X-FDA: 82194069216.05.F4B2CFD Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf22.hostedemail.com (Postfix) with ESMTP id 62EAAC0002 for ; Tue, 4 Jun 2024 18:39:25 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=MxRPowNG; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=HrGS3b+P; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf22.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=quarantine) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717526365; 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=EFfMVjj0307ATe57Wpr6UCL8Rk+6A4Ycxlj6HCesF/A=; b=yMWkK5SaWAB2cei5bh1H36X8/JDB1ksIFCnDJz6Som1T9kpQ9T559yJGI7kVqsHcm8Zkfl X9SlZJ58q1uybuVmjr5cORmPUaTG+LdvUIqNWuPmZGyDHhyvAS0LXew2odvm+s+qLk1YOb KOd7Ququf71uIRpT8vWIvWWzazM+2R4= ARC-Authentication-Results: i=2; imf22.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=MxRPowNG; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=HrGS3b+P; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf22.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=quarantine) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1717526365; a=rsa-sha256; cv=pass; b=STgvOu80F5t5Zu+0T/37gmy+SWTa4L6TcmqhFXhJ7D5TCI04CYi3fHmmdS1NMcStFdgufb reYhmHEaNZw9UQZmdnp3/dkT5kojBdEIIlrzAGV1cKcIaTG9fP1KwgBWn4HAqCe9lT0oGp cryQKy/ES+kuMFnwrkMSJt9hhSH/fdc= Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 454BnIf2028071; Tue, 4 Jun 2024 17:42:21 GMT DKIM-Signature: =?utf-8?q?v=3D1=3B_a=3Drsa-sha256=3B_c=3Drelaxed/relaxed=3B_?= =?utf-8?q?d=3Doracle=2Ecom=3B_h=3Dcc=3Acontent-transfer-encoding=3Acontent-?= =?utf-8?q?type=3Adate=3Afrom=3Ain-reply-to=3Amessage-id=3Amime-version=3Are?= =?utf-8?q?ferences=3Asubject=3Ato=3B_s=3Dcorp-2023-11-20=3B_bh=3DEFfMVjj030?= =?utf-8?q?7ATe57Wpr6UCL8Rk+6A4Ycxlj6HCesF/A=3D=3B_b=3DMxRPowNGd2saAS3eiLyrn?= =?utf-8?q?f3094PXk/wZ2viGL1WvVVMa3+ZvQSu5mX150sH2BPfuEB4T_nDufJJu9J5Aa/3ksq?= =?utf-8?q?NGXgtqfrE6EQzHNhcX+J41n7p2Ei06+R4Dwik7AfgYmE+8uyp04_kN6hwgeZwqlYp?= =?utf-8?q?CEcLtPTQYrkNlfTaA2C+wOmn/PtTKNSBsbStUdawznoVKqGSsQYjrwC_pU0bC0Yhh?= =?utf-8?q?Ts1fjbSO2Bss31ovyS2r/ppLwtfCL9qbAye1W8pLZgPdkt9d38/vkUxhDpI_HZOSk?= =?utf-8?q?/DMXqLu130nxNCgya9WxbyLWyphwOrSfmVbzxiq+XQsSc1SlOoZbRTWWv6zWY8b_T?= =?utf-8?q?Q=3D=3D_?= Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yfv58dj9y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 04 Jun 2024 17:42:20 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 454GNr3H015565; Tue, 4 Jun 2024 17:42:19 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2047.outbound.protection.outlook.com [104.47.55.47]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ygrjcnn8h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 04 Jun 2024 17:42:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XpCeQkY7ZBmEoTHs2vdXK8WB2CjJg4JWC+VH7L4sEkPcdy9G0qFPJdjWYl94CWKtLkRNSMEiFtW1WRxi32b1spAB7/du48S/jhILz55ccFYYurjnWlWeL2XiaYFK+RHADuJ4TXKa5Is9+NzPk5NSNolUOHqbBarh2oKeALZPOcnds0i7nGdSpEp8Z/takWl8ge+YueHvCa/C2azn7gp0h1dw6S8ccCAJyH6LLWzVVq6TRgsSkUdAHGS6lQPTp3lY73ln7vN567wzu5VWV0GA3Xl8V1W1DhALcsYvGCSso53bqu/IvZZmqlalQcRN1WM9yTAlLrzAHKqam2A7QsZxpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EFfMVjj0307ATe57Wpr6UCL8Rk+6A4Ycxlj6HCesF/A=; b=mJVu2Gg7AgF6BKePpOvI2Av5LN1oihP76yRoy0Nj1LG3SkdtUEwnY0bYGWgwIW9TNxZrSzVK9IjcBCM5ozcVCVEMIEvKJTgRTKbfhmoUguhLZxkg/+RbKnJU2U+d0W859r2aJDrEyP+KiDUrtaiaHieKBAQKToQwR2deLibYqj07NiEhxo87JQpLmyaM7dx+gTVmBEejGtObSoUz72naQMjFpND3InkS/jwBX7Tncn6WyYH6OrH5OeyOa1Sl9frX43vDKxMzJrvGfQ71GEA77D6yKAhb6Pc/1Jm1MNpq5urDuDHIX1JAvDYRj4TYYtVLlRCvMD+ixBjD4UKivBmUcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EFfMVjj0307ATe57Wpr6UCL8Rk+6A4Ycxlj6HCesF/A=; b=HrGS3b+P4DbRWhOPIMzuODGyTXiiKIMIpVicHlMkiE1lrAtVSN6Nerp3cEZB9EtC8cXuxMcfZFr6dQTlShCeQ/28NIkmGOKmrt3iFpMTEpg/IfcUGBodDp1YEUpo5ZVxAWwSjwiATO//K/eZBlO1qKOdDwz6//aPruSeLcU7qpE= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by PH0PR10MB5893.namprd10.prod.outlook.com (2603:10b6:510:149::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.17; Tue, 4 Jun 2024 17:42:17 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::eab6:6dcc:f05f:5cb2]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::eab6:6dcc:f05f:5cb2%7]) with mapi id 15.20.7633.021; Tue, 4 Jun 2024 17:42:17 +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, zhangpeng.00@bytedance.com, willy@infradead.org, Sidhartha Kumar Subject: [PATCH 12/18] maple_tree: convert mas_insert() to preallocate nodes Date: Tue, 4 Jun 2024 10:41:39 -0700 Message-ID: <20240604174145.563900-13-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604174145.563900-1-sidhartha.kumar@oracle.com> References: <20240604174145.563900-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR04CA0021.namprd04.prod.outlook.com (2603:10b6:a03:1d0::31) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|PH0PR10MB5893:EE_ X-MS-Office365-Filtering-Correlation-Id: 04ec3810-4fbb-4c8d-5448-08dc84bdad56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|366007|1800799015; X-Microsoft-Antispam-Message-Info: fx8YT6T8OoI7g9f+ur+pbGPrHdctdYfCvEZNDjXQK6r/F6AlgjgD4FvRq527/Y4YC/uPfjYyh7wckC9JPjSrOcj9jNHzGbrTuJTnsvE85gLIhT9yngY4Bi4eqIOiaFlWZblieMABwAul01IgTiMLaq4THSpjn2sOm1RzYwQajz+oW2rxm+UI8ydHlUqk1XfypibJPWMjzyb/MCsOqvCeCh8PS8dD4beKZeYnFiPY7Jtq22h2ya4M4Lk3veYxW9bemKLP36/cVvvTx01HTi30erYqumHmr1Uqyt3/5fPXxeZ4+V00chbdgqjHI8cxl8PGQex0cAW46rs0KVfLsNcX4iJmepnqpYK9bG6H2xGhXue8FxjAwgVRA7cytigapSFj27C26oCKtyP6Q5BA/FR1gfhTEH3aFZglflKZHiemgEug2oTKo444L8WKxU89gT35KGsbiyGQuCrTyBblcduFNUcvzrD9HEiQOk74RA3UM0JWHQcDnmqYph1IqPox5fTuUi7VDfj1hugZOQdEb5gR4HUyHUby02gw3mvK0mMo1Plgx5JXQ0ZnHkoOOOKWCNmM4/GSDGHazHf7sxuITUrZkI9QlwTyTkrnh4Yn6ERiqwthGvzwvGwLxtnUSgxYhBWov4U2RYvKnNvncBTvHU/xSMqYDOYI0M65PF2FQ8daxWvNWKCcJr9QuFH3Tu1cgkJQM+cpdtRsUToxeE5cxx559E6PuY0YyjcQ+jUlpNK/4QpG4xkShnbvWMmMXn+VIVZvqce5ufoyDtevsIazoctbpNUHBDIdRSD8QSz9bzw6gyYLx4gDpcjaNcQAEF9iILCcLnBD/+0z4frFAHg81ndSIgzh5FGslQBaXSN6Jogz/ImfxAHez2rbkKXCh55VfHVVhbq3QJYnoNs0sz0yB4rwCwI2kaH96Us+9+P+P62i74KMo7GoKeGPY3/K5sU0gj7qLocxsf0fcMZZ4mkDaRNL/UqlTpdC9sexvfa8t9J/IztH/mne9z9byqjbJTmwiNAGgMdMA6+sJ9TjnFNI9Ms21XsAcT+s8fUtATfC+bh+1nJfdxWXAE/4XxXfDStBDXF3sI/tCNEppuFgLUlgQFKIVkoIf6e0CA8i7GZWb/g6+gaZIJJVr1/+018Ma3ieopGqzKYpnDLMT6UmfTDpMgQ/YpuW3wDnNoQIT2Lai6zE6ljG4PZOe77cfEZ1JXwQwMtIkMIDkAO8QElWdcXLQfu7/h5qJUfiCDhwRdwxveFmTEE3/anaX84AlYAZOV4nAJacwm+Wc2g4B2sT7m9LIBySwjCIkNOgywfcspgbq9bn4uDHzRi9NchJ/PngEeAA8xcm X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(366007)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZinUU1qFYwWIC9W1nKI1//VZPfNSM1dL4ZyXfc/Hr0++9jxCblnT7Z4N4/lSWPNBgJ5CpVACT9YchnMvVDemWbitCKnq2xSeFq5wSe8xS4l+egxSfcHr5SOgvAThyU21Eq2wLNEQEC84xL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9EB+JGTleJ+tobgoyi8D/SPI8vcUZduUoOKIdIw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04ec3810-4fbb-4c8d-5448-08dc84bdad56 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 17:42:17.3339 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hJb2WTfQgHcTzFpbNcate9PY7xndkOcCA+OlEgNmKK26YiBT2FJmgcxUo6din0quAH/jg9ZQi7tk07ZMuzNmtqZ6/AVk9BrzmMLChgsYYGU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5893 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-06-04_09,2024-06-04_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 adultscore=0 bulkscore=0 spamscore=0 malwarescore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406040142 X-Proofpoint-ORIG-GUID: ZMVqSr4Kl0NzC6Lyq8I0ug1sQjfAqvXt X-Proofpoint-GUID: ZMVqSr4Kl0NzC6Lyq8I0ug1sQjfAqvXt X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 62EAAC0002 X-Stat-Signature: r1sfkuwxtxzya7h67sg16ftquiyw8i5s X-Rspam-User: X-HE-Tag: 1717526365-576706 X-HE-Meta: U2FsdGVkX1+vVLiZNWxUqAOzhSCB/UiLrT3Ruq1Sr0pG4RjQOfm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wY/CBRkJ4ihlpYkSV5saVO0479PD2Nwpr+9yap459dYH1bz+bdIkYMSmeA4cJbsZz4N3v4nffYChpC0MgKPwSddCItl4Rj6kd+0Ui7oaUoe01syi7/a4gTFBVyrkybjUd5m8l81U6OhgjYxSUIU7lQSYh0XMzi27uIbmvmSdiT66F6INHK4tFBL8cen/njBhZHn7XhKcir4ndK5LFceX31k6y8tJEZ1KpM1u/GLtsT0WMF3nDDAZLI3n888aa13/hT9TTELfzr8EWEU2FuaY1ZxDDlQYIzEQsmBSWTwz9iFWOvCGpYyhxE0bp6mp6sw3NqxTdWTRyHw== 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: By setting the store type in mas_insert(), we no longer need to use mas_wr_modify() to determine the correct store function to use. Instead, set the store type and call mas_wr_store_entry(). Also, pass in the requested gfp flags to mas_insert() so they can be passed to the call to mas_wr_preallocate(). Signed-off-by: Sidhartha Kumar --- lib/maple_tree.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 20e9d13c2980..314691fd1c67 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4445,7 +4445,7 @@ static inline void mas_wr_preallocate(struct ma_wr_state *wr_mas, void *entry, g * Return: %NULL or the contents that already exists at the requested index * otherwise. The maple state needs to be checked for error conditions. */ -static inline void *mas_insert(struct ma_state *mas, void *entry) +static inline void *mas_insert(struct ma_state *mas, void *entry, gfp_t gfp) { MA_WR_STATE(wr_mas, mas, entry); @@ -4467,26 +4467,24 @@ static inline void *mas_insert(struct ma_state *mas, void *entry) if (wr_mas.content) goto exists; - if (mas_is_none(mas) || mas_is_ptr(mas)) { - mas_store_root(mas, entry); + mas_wr_preallocate(&wr_mas, entry, gfp); + if (mas_is_err(mas)) return NULL; - } /* spanning writes always overwrite something */ - if (!mas_wr_walk(&wr_mas)) + if (mas->store_type == wr_spanning_store) goto exists; /* At this point, we are at the leaf node that needs to be altered. */ - wr_mas.offset_end = mas->offset; - wr_mas.end_piv = wr_mas.r_max; - - if (wr_mas.content || (mas->last > wr_mas.r_max)) - goto exists; + if (mas->store_type != wr_new_root && mas->store_type != wr_store_root) { + wr_mas.offset_end = mas->offset; + wr_mas.end_piv = wr_mas.r_max; - if (!entry) - return NULL; + if (wr_mas.content || (mas->last > wr_mas.r_max)) + goto exists; + } - mas_wr_modify(&wr_mas); + mas_wr_store_entry(&wr_mas); return wr_mas.content; exists: @@ -4531,7 +4529,7 @@ int mas_alloc_cyclic(struct ma_state *mas, unsigned long *startp, return ret; do { - mas_insert(mas, entry); + mas_insert(mas, entry, gfp); } while (mas_nomem(mas, gfp)); if (mas_is_err(mas)) return xa_err(mas->node); @@ -6532,7 +6530,7 @@ int mtree_insert_range(struct maple_tree *mt, unsigned long first, mtree_lock(mt); retry: - mas_insert(&ms, entry); + mas_insert(&ms, entry, gfp); if (mas_nomem(&ms, gfp)) goto retry; @@ -6581,7 +6579,7 @@ int mtree_alloc_range(struct maple_tree *mt, unsigned long *startp, if (ret) goto unlock; - mas_insert(&mas, entry); + mas_insert(&mas, entry, gfp); /* * mas_nomem() may release the lock, causing the allocated area * to be unavailable, so try to allocate a free area again. @@ -6663,7 +6661,7 @@ int mtree_alloc_rrange(struct maple_tree *mt, unsigned long *startp, if (ret) goto unlock; - mas_insert(&mas, entry); + mas_insert(&mas, entry, gfp); /* * mas_nomem() may release the lock, causing the allocated area * to be unavailable, so try to allocate a free area again.