From patchwork Tue Jun 4 17:41:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sid Kumar X-Patchwork-Id: 13685737 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 5A797C25B78 for ; Tue, 4 Jun 2024 17:42:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C475C6B00AC; Tue, 4 Jun 2024 13:42:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF7FE6B00AD; Tue, 4 Jun 2024 13:42:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FC4E6B00AE; Tue, 4 Jun 2024 13:42:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 802A26B00AC for ; Tue, 4 Jun 2024 13:42:42 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3B7BEC0FF3 for ; Tue, 4 Jun 2024 17:42:42 +0000 (UTC) X-FDA: 82193926164.05.30CF13B Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf26.hostedemail.com (Postfix) with ESMTP id D378414001D for ; Tue, 4 Jun 2024 17:42:38 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=QRrkR52d; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ndMT0opI; dmarc=pass (policy=quarantine) header.from=oracle.com; spf=pass (imf26.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717522959; 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=WeX6GL25hnGC9aDaBruf9RjJKsgQfe5nXvPBB1WbfRE=; b=gAdWV+S8IB3zn2DpSBH0bqcdGaj+IPUkldBppq8y2hfZSOnG4aTWFD9y6lTs1dwIThsoDF J/7dYvOemBrVssXMEWw0Kle0YVVNylV5vFiMw9dyVp7/hAqM3o+htEIFqdG3wKlzx9uaXV szL+khRCy+ydZSaRzDRzCTrh4aUWcEs= ARC-Authentication-Results: i=2; imf26.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=QRrkR52d; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ndMT0opI; dmarc=pass (policy=quarantine) header.from=oracle.com; spf=pass (imf26.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1717522959; a=rsa-sha256; cv=pass; b=H5TNDoaGkyMFOwQVSXYHXTfOOs4+QqhaPPXL5YmwBCtS3+iWzUi68JmQ0qHEWd5y2vKvdp aRVMZtvm3e5uIJA8B+dtmaCCmLolMOs417QYX8jGlH3GpCzp4iCYQLi4OMHsjx1Ras/IIY aHTv20iZ46DCCD1gTXBsl6kd7WCPT6Q= Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 454BnRkg026498; Tue, 4 Jun 2024 17:42:27 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=3DWeX6GL25hn?= =?utf-8?q?GC9aDaBruf9RjJKsgQfe5nXvPBB1WbfRE=3D=3B_b=3DQRrkR52dgdB8E69+PjPNG?= =?utf-8?q?WyEEZGkYiIdHhMn2Tro5Ma3d/co0Zd1e4GDR7GI0k7furWw_Of9rQLLdeyDfRg9GV?= =?utf-8?q?BQhyrWzRar/EMpbgb7y/dli1PgOqD2s16DpOZCNppwJiR/cPw9g_vbIlBojRNoclY?= =?utf-8?q?ka/x29Gqi8IEuhbykapAwEtngqZIL7i3s5CtLnU1oJ4Wu7P5Q+mhh9I_hqdnpYSLj?= =?utf-8?q?dj9hReVw0znSKwIhtN/A6pD3no1Ajbx/a90EfHKT4NmWYA5t/2psUxcYBwG_awHZ1?= =?utf-8?q?lyGKOhkWNmMx5/4AFA++OWAtBaWXcDkwx1AN745lc9MCBNs2c2c6e3dSplqEZ43_d?= =?utf-8?q?w=3D=3D_?= Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yfv07wjyn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 04 Jun 2024 17:42:27 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 454HaZ5b005523; Tue, 4 Jun 2024 17:42:26 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2048.outbound.protection.outlook.com [104.47.55.48]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ygrmdwneg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 04 Jun 2024 17:42:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NM6v0rhj+1nwdIn3+vXXhvhVY5r/j0jkr/iQiZHHxlNeDHwtihXdBO9MuHHZidSTEnQNBo+rSDqIoEMS7DLMAXFVZclZMFvIk2ccGKLOcjMQakKRcSBcMY7U+tbjOVfVVaYpinFvWbH1IFmFbM7zrpdffKHI9U1fX0i8xVja08RzbHBkWKiNXRuvcQjnrX0mYU90eR2gfjw5vWovVAdQVONmO12vE25SVUL2fgGnuuttK+10phZiVHLeaq23GiIpAkCKjBGvgOFhYInmYeGqYMCfsCALXmF61gnNyr/wqCo2o9Y2YQ8wu2D617kSy52hzVvky4lzXtA2+biotIqxMA== 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=WeX6GL25hnGC9aDaBruf9RjJKsgQfe5nXvPBB1WbfRE=; b=AMZOf/piO3d1rYFP5JBg7BSXFoUf5MPWgEax/GPDQF2tsV+BRCFAjlBUF+6PRD5lxvg6SBna9eM7S6+vGUkLFM2D0mEWMneug7kSfJdgPmChuVQE5qItJ1ors1QIzbQPN8/PRQ7lnBU0BM56l6UQ3uX3+k7b2MK7G+Rrma0Cr72R8yZrqhlR/AfbkWu2++Gh0yGPCO9M1a8F2JusXXOfEjcsDaxW/APP90OnUWM0O7ayStf2gfVHeqX09SN7/w8CRVfwK1uAkSsmnEFhW+LGbeTx5JAs1rHjV2jjM0Y5ZrAm91mwMHMLLYYEggR1Ub0u9+dFBi/o5DxO77lN0OxpaA== 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=WeX6GL25hnGC9aDaBruf9RjJKsgQfe5nXvPBB1WbfRE=; b=ndMT0opIC9U3z7y7JtW2tnRaUQynlyL9O1lDPoLsm7MP3UVD6Mw1NVKks5NB4pxYxGVhZIxX3eQj7g6g6DjKcxirmr7jOfr/2WgCOBYW2K4+1iYO41sws+kQCZnFKCfYAo/QFWKSB1RrgHEa5+IRfabJZIEHKc4Np32Ut1HPHHw= 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:24 +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:24 +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 15/18] maple_tree: have mas_store() allocate nodes if needed Date: Tue, 4 Jun 2024 10:41:42 -0700 Message-ID: <20240604174145.563900-16-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: SJ0PR05CA0047.namprd05.prod.outlook.com (2603:10b6:a03:33f::22) 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: 3ac6587b-87c1-42be-d999-08dc84bdb15c 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: r00WyTM7Y1RnVW/wjBUuT+CLcybtSUe1cLn+KavO7kwl+K+0h2c4l91MpxFyQ7u36sqp3hwoqUmgDIQySs3ovSZNYP5UdwDmb0msZd30QxWxfZnm1js4+JEftQ+cf85ayj6EWOh7TfQPb07IvzNv+rujiga8yDII19fEuKkOSCefBlUFd10KhGcf2pose0Zd2hu4004zjNNA1u1JgX/WDFPoB38TKQOrAdMA2dLx+Szc1tuicCyGRBNxKBpp3L7REYLAbjeAAQNJ41IRFEPQeN3qwafN6FdTVnkrPNl7C8DgsBifmTQc9ALOG0EUbTSF8Kv96eTW9skU2J1ym+cEGqhNsF+W47sWTQCyQgl8CbrSI18Gk7UI9m9/rrHcS8o/Tl4pQDqr8ETAXl30QTGWgxEoVRbABPJDR20InWK7XhSagr75KUXhrneWgEcMmg/KylPVPDLxNtqZ+EcooIjdBW2ECsDnrytPx/tl03z3tYbe7wfsHaQheHITi9/RQZ3OC4VEv0NxvG6G3RLw6iVOke48plw48knkvG+V6M95Tq54hszvTYgE6HGYU0fX1s//v8GqllNn34mWj7KyPuVfUJQCeHgfr4deOyh7YZDbBbWwGC3YcwRdRQHNbFxXsKdZygdtQLZYCK/jH6pjFwYCGVDgDU4/qm704GF+ZFU+ptbRNJu619KdWKW3VrvdZYTAaX2wQFrPn/Pgz0ARDbKWxy/aijGF1zekPDs/Yyd+8et7q5hVdfs4i+pDbwIGdRE6+Y4AND6nKc37kpcXpN6Ux1yhWFHBc84bdT7XwA4X2BMMIRKJNbGIh0+gQqZVoSyS9HuJJIq4qee+eV9TsLXB3LVPBCMdzwAKJtSKdWLrtwTwI+mId46BFH9QkV1c7yfYoKHVbZ4VZJMU6yrLyzBYJEnxg1t+93tNqyHURNeOBFBKNZfCWJBz4Pptd11YZIc9vE0hCmbk/c+H5lX/3KMKNrQyePIoDLQbBfXqGXZD3LdQRYZEpf2ZDpqJIXxIq9LSd/yOatPHvr/2LFjqsp+jjM8qXf9oVsc02a0fljs3mjHUhZNCa6M57iX8UP8cC8aaA9lILcJYKNNmLhySradhB7CYEFwIHVz13ksU1/IfEKvGJ8ubMDV4xffRRYWYdVyINiB/hsYtHqEDPhldIAV9fQK54PHPdIOjSrPUzUU/U5DbR8MWDa/tSnm8g0upbfaPw8fWo73fJFxdcTfnwQjG6sANImRWxNIGCOshofavRmHh4WHO/rRtFdSgv6S7NQmSouLzSTrzuhMWVjOAw5zt2IxUZ6o+Qqi8S17AODBsRRpZ2BcmukvOud8b3Niq8pnv 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: FUNxPaOKGGIpBDcrulIZDC/9QiyIv+tb4656ixOsth2MzU/mtufgXilcliVLqFvejcR7LhX/hq9LCfk/+sa9j/itQSGUgT3jEpp8smhYB4lC/3ztoHbU4vXP0FYTjln7CYCBdnC07ORnIZWEz610wCOn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6QFIlZFQJpUL2hP3ff0JRaw3YFc2M= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ac6587b-87c1-42be-d999-08dc84bdb15c 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:24.0725 (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: wOBtlI6fABzyiKXYfONatcmFi0A4OoYPogci3Cnri53ViV6XFBpFVvuua2z0OZIjBedNPGBOtGFvLA7GxnNQoeChtQ+aD63RaB+q9OI4F+o= 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 bulkscore=0 mlxscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406040142 X-Proofpoint-GUID: -P_sf5WsdP8KvgGPyKUYg2Zhc89639JI X-Proofpoint-ORIG-GUID: -P_sf5WsdP8KvgGPyKUYg2Zhc89639JI X-Rspamd-Queue-Id: D378414001D X-Stat-Signature: qyd5i1ahxxjhoh6q4msfk365y8ronsst X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1717522958-665497 X-HE-Meta: U2FsdGVkX1/8oNJ3Abzhlk5VgDSoSy8sjXjcoVfSt0lZ5Vuux0MKN3M4xq8Ep1N/c8Qv41SK8BCYjq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CCxrpGKnXFL4vTV7AXCqdtbjxRm2X1+4f33nwmB8kuX8/BzKpAA0+n6CuxJUGPU5xtxkU1GHTmmj/DuxDmhRAV7WBjifM8Ter/2e+56j00Xk4M3TGDcnVBCwGJDJGTv0m1CKJQGWSznTUGhViMFHK0tbIH95LXrkk6GwO4FNFZNp/dgb4jLxKleJmETU21jeBmZmRtByBoBfTO3fnDYQ1K3VhEnfMyEkloWQXlfz2ubgvDff5jYzPPkkNhy4jw5NPepfn7feiK9jkykWJaizn22tfxTZ7l6gyzW97XX5QoNAkMa1NkmbgAv4XlwdBgU= 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: Not all users of mas_store() enter with nodes already preallocated. Check for the MA_STATE_PREALLOC flag to decide whether to preallocate nodes within mas_store() rather than relying on future write helper functions to perform the allocations. This allows the write helper functions to be simplified as they do not have to do checks to make sure there are enough allocated nodes to perform the write. Signed-off-by: Sidhartha Kumar --- lib/maple_tree.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 74c89aad8bca..42853afc3885 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5527,6 +5527,20 @@ static inline void mte_destroy_walk(struct maple_enode *enode, mt_destroy_walk(enode, mt, true); } } + +static inline void mas_wr_store_prealloc(struct ma_wr_state *wr_mas, void *entry) +{ + struct ma_state *mas = wr_mas->mas; + int request; + + mas_wr_prealloc_setup(wr_mas); + mas_wr_store_type(wr_mas); + request = mas_prealloc_calc(mas, entry); + if (!request) + return; + + mas_node_count(mas, request); +} /* Interface */ /** @@ -5535,8 +5549,6 @@ static inline void mte_destroy_walk(struct maple_enode *enode, * @entry: The entry to store. * * The @mas->index and @mas->last is used to set the range for the @entry. - * Note: The @mas should have pre-allocated entries to ensure there is memory to - * store the entry. Please see mas_expected_entries()/mas_destroy() for more details. * * Return: the first entry between mas->index and mas->last or %NULL. */ @@ -5562,9 +5574,21 @@ void *mas_store(struct ma_state *mas, void *entry) * want to examine what happens if a single store operation was to * overwrite multiple entries within a self-balancing B-Tree. */ - mas_wr_prealloc_setup(&wr_mas); - mas_wr_store_type(&wr_mas); + if (mas->mas_flags & MA_STATE_PREALLOC) { + mas_wr_prealloc_setup(&wr_mas); + mas_wr_store_type(&wr_mas); + mas_wr_store_entry(&wr_mas); + MAS_WR_BUG_ON(&wr_mas, mas_is_err(mas)); + return wr_mas.content; + } + + mas_wr_store_prealloc(&wr_mas, entry); + WARN_ON_ONCE(mas->store_type == wr_invalid); + if (mas_is_err(mas)) + return NULL; + mas_wr_store_entry(&wr_mas); + mas_destroy(mas); return wr_mas.content; } EXPORT_SYMBOL_GPL(mas_store);