From patchwork Tue Jun 4 17:41:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13685729 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 7F3D9C27C52 for ; Tue, 4 Jun 2024 17:42:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8EC3A6B009C; Tue, 4 Jun 2024 13:42:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C0BC6B009D; Tue, 4 Jun 2024 13:42:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6512B6B009F; Tue, 4 Jun 2024 13:42:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 41DC26B009C for ; Tue, 4 Jun 2024 13:42:21 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id F0521140581 for ; Tue, 4 Jun 2024 17:42:20 +0000 (UTC) X-FDA: 82193925240.30.52C2E77 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf21.hostedemail.com (Postfix) with ESMTP id A8C361C0002 for ; Tue, 4 Jun 2024 17:42:17 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b="K9iVMb7/"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=IO0Y+gKx; dmarc=pass (policy=quarantine) header.from=oracle.com; spf=pass (imf21.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.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=1717522937; 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=sxrYTRYvoigB/XkLSP2+ypvpJsb1vcDv+m8BGSQSO4g=; b=zWFsOy3wv84s3Ni1mA8xczhp2YfGA2kpyUDcS588VJQ/FPx+r1od6s9M2jbvzwOihxCoAO OXWsejUjzG4xwcOaKtMIQ0BjIHpKo4lzjdccuHRKSxAsWVWL2N1b+5yMAbXVL748+qn8cS 6uJ1H2fpa8z/kP50PLFei2TxV5LNNtc= ARC-Authentication-Results: i=2; imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b="K9iVMb7/"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=IO0Y+gKx; dmarc=pass (policy=quarantine) header.from=oracle.com; spf=pass (imf21.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.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=1717522937; a=rsa-sha256; cv=pass; b=DlLBsih9ywuu+MY+ubDbXSJFF2zG9+R7LhXb+I/K866djocvyfGB83eg7u82dWJlIQAJZ5 QrDlEE7T/5aG8BGNkD4Jna1lEbDXYfB/PnvWp8dP0ROfvV1m4yXWNTkaGdr1Y+eHrVT21X HFnA3Vobc5OfgabGj/6gL+BziTVnZzA= Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 454BmnYg004596; Tue, 4 Jun 2024 17:42:06 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=3DsxrYTRYvoi?= =?utf-8?q?gB/XkLSP2+ypvpJsb1vcDv+m8BGSQSO4g=3D=3B_b=3DK9iVMb7/8bsugmfZETKm0?= =?utf-8?q?cbXrbUuvJp9IaJYFs6qrddoucnDb1PtrhJ9Kwb583j6o67r_OIgakkIqNr6etshfV?= =?utf-8?q?RorFV1Mv2YOAleZPYfRW3vENA4vTTwCLndXyFOZ+Gn57ANyqKt1_I6uhsuaiUwhhL?= =?utf-8?q?G7+eVgZMEFro5Z8K+fJ6kj8XzBaMk+T8g5K18BpKZN3IC0oBfYaTt0J_YlLXlGXSy?= =?utf-8?q?k3NEgtm4bEd/itYGHA3coyMjLixKYA1+B7YXYjga6+t9I/zAx3R4H8ZOClS_GObyC?= =?utf-8?q?RAc//IMQ2Y7rwCJB7ENISba0d6CMIA/KsU0zj7rF2LOYc4rtkgirQLisYYCWdPS_C?= =?utf-8?q?w=3D=3D_?= Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yfv05dm6x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 04 Jun 2024 17:42:05 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 454HZSFH020575; Tue, 4 Jun 2024 17:42:04 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2040.outbound.protection.outlook.com [104.47.55.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ygrj2bm4e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 04 Jun 2024 17:42:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TIntDJ9AefBFwnVgkwPCeyeF85kBcEGH9s5nsgtKEKf/EJ8oyXe4znbVcq+113iePsEsnxQtKAtqEwJb+KivTDC8EIPimb46svE3v9cgY7L0EEek9avuuXayEAusOgyB5XLEBoIqeh4aQrapZD0lEnFYLmiVz6YaoifJrIrPk4Sug1IpTMmXT6LZKeRFXd3oiNaXKNSkmXhjjjSuBRFCJTnrFQaxK9/i1KO9jXdLysbIfBk1N7dsDkL0NMZAHXk2357nMr3L+r7TaH2DS8Gsq3SENkoIfBF9KJ91adfRGUC0A/S3q3FBMr1Z1Z9EkeXRz6uJ173sUql5athJC8q19Q== 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=sxrYTRYvoigB/XkLSP2+ypvpJsb1vcDv+m8BGSQSO4g=; b=XOAvCgeBw1Xvzv4S8Ed9PGHllPJ6OQB0BGJh7WmutkjsAwcVaE3gl/bkfjagKdyXfhat+5O2jlJEAhomh6g1IxVCPOnDOhFyJFZaKSlIU+LtBfd6Crf6FuMg878HNmctLZNR5eAVxdFo8zRDuk/E1F5arhFDdB923X/ebfx1hixZPwuOIg1gieSbu7xlCaEE3HpaEGL4YvQ7CTfDjPOYq5jJQH58kXfM2kEbaUqNv4I4y1Yj4BQNAQJL65bTHiNd9afsmQy0qy4sjX9gFy9dKdMUZ2FPtCEksdmqnh7oGTTGhH6lXT4fWT0V49sAbrts7Q0uW5yeR8qr1SInnKfhCA== 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=sxrYTRYvoigB/XkLSP2+ypvpJsb1vcDv+m8BGSQSO4g=; b=IO0Y+gKxTgSPwS2pbDvR0b5IXXKxHkAvdypkUy4iddaVkFvYqK5+uyv/JwNQy6VhRChf3Nqr2xJiC21JsvBVHQe6nQg5cdZjqiIFoHxJ78IsidI615QTaFO6IrHzR5AA3ozOmsQNu/KQKqCWKI3ZTtQoLdzwDTVcRNt5SegQRMw= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DS0PR10MB7269.namprd10.prod.outlook.com (2603:10b6:8:f3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Tue, 4 Jun 2024 17:42:02 +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:02 +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 04/18] maple_tree: introduce mas_wr_store_type() Date: Tue, 4 Jun 2024 10:41:31 -0700 Message-ID: <20240604174145.563900-5-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: BYAPR01CA0027.prod.exchangelabs.com (2603:10b6:a02:80::40) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DS0PR10MB7269:EE_ X-MS-Office365-Filtering-Correlation-Id: fc28ba54-eeee-4838-f824-08dc84bda424 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|366007; X-Microsoft-Antispam-Message-Info: 8rfWhw7tUH17U+tDmOxdT6Iz10FK+vgATom1Yk8KNgmdhRxydxN4XBly/0oxCCH4bx8UjzYTZI1YzNOksEMGrbZulDO7lHTdhh2/2piXqBNw7j+NQUIBGR/KMucSj8WP12DobV12maS5iF2Td7X1s2wTi8dSf8Hh/qMIXOV8wPhCCMsic4AjgluwKZorgMEfBjdyHsUViruUwleCaWwPjX2Ur+i/7qJqC2iG2y50MPupTyXmPlo+0GsVMw9fL+XuN2/n/GEpC7mvSwCpHOsfmeLdPj2V+0NrNQMCkUHRxmXv15c8bGaKsByU4JTCbbJXOshoKwLRk6CIuQI2WQxG+bS+KFQrZwF8zhp0YB2/7cS80TQbYVMkE+oNqdDAKNnlyvABKl3NrH2R0CjxLs12s+GT9Zui2xvXmePWcCmwCjqSJHQD3ydPPBUdEuqx9Wrutu2jehgYYlSQGGm5Q7Ekm7P/FSNBEQF3IjVXAvGR/zQyZvL2LN+2/E4QgAUHNNkcTEOsuXyPKLy1DRt6i5aLYM2Yg5Crlbecpozif8Alv+CL3BKjFOrhAqkvgQowe0bZQLxV/2zZBaEsbEQYUhhJuGLMeqgWRFuUN2F+v17dNQ+4nYWdMGnACVIKxHvyPZa8hjDJrPDFwn5BACOczmK9AmxFEq5DVG70TNqvlYJa1WhP5JE/wWyxHSpkiwSLwWJhyTcpg2vmJVVqhc/wMsjwTWTm8a+OWEmlRlisqvwNoUQAzCzhwh3Wywxjgv6CJRQbRBPVcVyQay9yOCm4cS/1I5jPNwtWB2idTl7swmaJDCX6f5Ag5QtAVrT3X0qCbacgSi0dOKwxMk5AR+Fd+/lool03x+l5Fwq0tTksbNdci4tQQc/eXxjzjiZFLTvfekuDzHzls1JoLqSL6f766ISCnNDCPIUUflIMcQJ5sJ+XUPdrtDrfBeQsJ6Q106xdyyfc1hfRBr+cdLuK7Crgh5/qgiC7MSVg71F37URHqo1flaTD37C9KAV+/3f5c4byIqK7/q/d7CdYRy2q6kTfhMujHD/3LpTeAXnjXWQCTvVHGfdPmBTDQCzIW9P8WKrpopniZDV/IbKqABoM5TigP76xyUudjTkQrx8wc2y0qqiVOGt0EGmJkTRr4GSAoA44LCeob1bCZn845mW4fQVIPHGoYdE/1DIr5Qk6GnSlRzzBIAj5s6Ym4JqxBqWLgUmYrTVoG3sGRr48YrUqVAe0Kvuu6d+4aDBglGd7WWbcTd7FAsSejCNOhbtmCNcRVq3JVScO1j1Zs0mn6paQsCdkNF1BjEiavrtInnAxcYuazoEXSrra7aVRB9sS+5O0F78n9LiB 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)(1800799015)(376005)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: whU6QgvMljXOxjbgFfOqml0HuJoJYuYJEIRS7kh/K0lIm8lz58JLu6A0eUwtnfFSH1COsDBfhKvsnIJPCQTYTljKZxwdCYTajV12FjCK8CKkUAL9Yrtx0IShdbui9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96jsnCFBta3FcNaST5fPLacSxn7oQ3RHh84vbQxXRxY2sUb6ZdzxipyTNraJbqKe4v+EulQ0rSWmCLutjECyTuP+23epCOwy9oHGvB7pUh/oOWtubydmBFoZiHu+oqOwGilAEngeG/siT8plaeUSyrHqnnHOy2iiNNUx0KxYjksVVuY2WNtjJpgZt/X84rFlULYjUluKFnLzWdB8RWDVOpRxqE5YfFgWtym/fhkzjpo3KytxEI5+HFQFknAudGTTLb07iPja+OPq/Co1q3HSzXeiyfM3hqlw677qaqtHTB2jaTSh+BwLtVKINR/pb/IL4HOyj8edVFwD5La6SckFTJnnlmuBQ+L2d0DNfi8JlbxdY3cbT9InPGLtAgC/fNW1GptMqX1shiUZ6vC6v1/7nruF9WkHBxgN1g2A8fEEnw= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: PKmCBa6bXhPzIPNaYpJjYkhN1I+eGNpEFbECtU26nZ2VG9FX4HyYtRKsKKaEvBxvwuWuQB01qc7xqyvXDZwPfa7f91YfhhF9kO7ivKxi6ZUqdjb1xZmkAShn73jmHdWwJ4Fog4nedl3mgydgZlGH+TUuGjo6GdK1xiX+QCSHeH4POMGC4tEa5KQqYievM7moV4IsFii2HNQNamGNhD0+t0rIdWoSUJcpOu3RqsSFkHhQo837ab0WGX8HQLP2R++vCsf9WaGR3EHv180HSykPLGpCO/lOQlgB37OnVMJC2/KvwnU2krcgv0jecAKGj+qs96YCl1v69g2WLYGGJm9voNACgKsNx2wIMksjV8JI9J4rTR3I9sozTYlHQxTaIJ+EUMNOiWOx5CcdOGjFAra1YdAP4EIWBlLW3D49uFp5/5RqNztOXvkNIybxAOZ+BJiyhULmBCezx8H9L4rmsB5Z8Q4fxnxBNc1IEq9czB2EDJMXKJaws8LD1F4k93ofqV2t97yk3zcLDAa33p894bT2wYMirrcfoIlKb+xtiMNvTu5BbhWfaf7IhDQPiMSv3z86uucw9lvEvOsqgrYV7Mc4+55lE3G6294Us0HrIFZEspA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc28ba54-eeee-4838-f824-08dc84bda424 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:01.9247 (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: AnFpy5mhFD1h2bdkdlSEsFVGh+g9qCQSrklkNjo5PAOUUZ8VvaqXIhcEbVP6/vZQJxshVOEUtBUL/cxkHXCJBdAHRZtBFF2fjOEhhFptZ18= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB7269 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 mlxscore=0 phishscore=0 bulkscore=0 adultscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406040142 X-Proofpoint-GUID: Jgkfsp6eopO60sV-NnsTncDGs413UkCW X-Proofpoint-ORIG-GUID: Jgkfsp6eopO60sV-NnsTncDGs413UkCW X-Rspamd-Queue-Id: A8C361C0002 X-Stat-Signature: eo54eriiirz59a5t39bnd8r3iyeriwx9 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1717522937-503429 X-HE-Meta: U2FsdGVkX18MW18DxR391tS3K+kyibciEqnPGQi2PEfcUJlwAlyWrN2oa7FhpI0huqEYyt1877QS/SYk+nrAUyhYoexZOVtLNK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RbHxJO6Htcxi90OvLfoSmgh8WWgiH33qmldAqRxWEnqjYcuVmiyq0oL88KCfEvuh7oHuhqIItI+T1kU5D80+pgx49DE4irSdg08552Ps7d1z0sqagr3Gy8tO8MU1UjLKgHH5ko7uNeZqbj/sksGq2s0DiQGN/qW111180OcNdJDDs/ERFiew+pxJWFPsmPTOVJboJPZnIpyJHoHM8+PsaJo8xgHSqAd2+dsBbqDqWK2LO5iwfuwlOJM1srORsgb6OhYQXFkajD4SZjo04/Q7JPrYArQACLtAe7EsRKBoHebbYmiD0UsZCoraMIhQqyxqKg 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: Introduce mas_wr_store_type() which will set the correct store type based on a walk of the tree. mas_prealloc_calc() is also introduced to abstract the calculation used to determine the number of nodes needed for a store operation. Also, add a test case to validate the ordering for store type checks is correct. This test models a vma expanding and then shrinking which is part of the boot process. mas_wr_preallocate() is introduced as a wrapper function to set the store type and preallcoate enough nodes. Signed-off-by: Sidhartha Kumar --- lib/maple_tree.c | 210 ++++++++++++++++++++++--------- tools/testing/radix-tree/maple.c | 35 ++++++ 2 files changed, 186 insertions(+), 59 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 2558d15bb748..b37fa8690558 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4278,6 +4278,150 @@ static inline void mas_wr_prealloc_setup(struct ma_wr_state *wr_mas) wr_mas->content = mas_start(mas); } +/** + * mas_prealloc_calc() - Calculate number of nodes needed for a + * given store oepration + * @mas: The maple state. + * + * Return: Number of nodes required for preallocation. + */ +static inline int mas_prealloc_calc(struct ma_state *mas, void *entry) +{ + int ret = mas_mt_height(mas) * 3 + 1; + + switch (mas->store_type) { + case wr_invalid: + WARN_ON_ONCE(1); + break; + case wr_new_root: + ret = 1; + break; + case wr_store_root: + if (likely((mas->last != 0) || (mas->index != 0))) + ret = 1; + else if (((unsigned long) (entry) & 3) == 2) + ret = 1; + else + ret = 0; + break; + case wr_spanning_store: + ret = mas_mt_height(mas) * 3 + 1; + break; + case wr_split_store: + ret = mas_mt_height(mas) * 2 + 1; + break; + case wr_rebalance: + ret = mas_mt_height(mas) * 2 - 1; + break; + case wr_node_store: + case wr_bnode: + ret = mt_in_rcu(mas->tree) ? 1 : 0; + break; + case wr_append: + case wr_exact_fit: + case wr_slot_store: + ret = 0; + } + + return ret; +} + +/* + * mas_wr_store_type() - Set the store type for a given + * store operation. + * @wr_mas: The maple write state + */ +static inline void mas_wr_store_type(struct ma_wr_state *wr_mas) +{ + struct ma_state *mas = wr_mas->mas; + unsigned char new_end; + + if (unlikely(mas_is_none(mas) || mas_is_ptr(mas))) { + mas->store_type = wr_store_root; + return; + } + + if (unlikely(!mas_wr_walk(wr_mas))) { + mas->store_type = wr_spanning_store; + return; + } + + /* At this point, we are at the leaf node that needs to be altered. */ + mas_wr_end_piv(wr_mas); + if (!wr_mas->entry) + mas_wr_extend_null(wr_mas); + + new_end = mas_wr_new_end(wr_mas); + if ((wr_mas->r_min == mas->index) && (wr_mas->r_max == mas->last)) { + mas->store_type = wr_exact_fit; + return; + } + + if (unlikely(!mas->index && mas->last == ULONG_MAX)) { + mas->store_type = wr_new_root; + return; + } + + /* Potential spanning rebalance collapsing a node */ + if (new_end < mt_min_slots[wr_mas->type]) { + if (!mte_is_root(mas->node)) { + mas->store_type = wr_rebalance; + return; + } + mas->store_type = wr_node_store; + return; + } + + if (new_end >= mt_slots[wr_mas->type]) { + mas->store_type = wr_split_store; + return; + } + + if (!mt_in_rcu(mas->tree) && (mas->offset == mas->end)) { + mas->store_type = wr_append; + return; + } + + if ((new_end == mas->end) && (!mt_in_rcu(mas->tree) || + (wr_mas->offset_end - mas->offset == 1))) { + mas->store_type = wr_slot_store; + return; + } + + if (mte_is_root(mas->node) || !(new_end <= mt_min_slots[wr_mas->type]) || + (mas->mas_flags & MA_STATE_BULK)) { + mas->store_type = wr_node_store; + return; + } + + mas->store_type = wr_bnode; +} + +/** + * mas_wr_preallocate() - Preallocate enough nodes for a store operation + * @wr_mas: The maple write state + * @entry: The entry that will be stored + * @gfp: The GFP_FLAGS to use for allocations. + * + */ +static inline void mas_wr_preallocate(struct ma_wr_state *wr_mas, void *entry, gfp_t gfp) +{ + 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_gfp(mas, request, gfp); + if (likely(!mas_is_err(mas))) + return; + + mas_set_alloc_req(mas, 0); +} + /** * mas_insert() - Internal call to insert a value * @mas: The maple state @@ -5506,69 +5650,17 @@ EXPORT_SYMBOL_GPL(mas_store_prealloc); int mas_preallocate(struct ma_state *mas, void *entry, gfp_t gfp) { MA_WR_STATE(wr_mas, mas, entry); - unsigned char node_size; - int request = 1; - int ret; - - - if (unlikely(!mas->index && mas->last == ULONG_MAX)) - goto ask_now; - - mas_wr_prealloc_setup(&wr_mas); - /* Root expand */ - if (unlikely(mas_is_none(mas) || mas_is_ptr(mas))) - goto ask_now; - - if (unlikely(!mas_wr_walk(&wr_mas))) { - /* Spanning store, use worst case for now */ - request = 1 + mas_mt_height(mas) * 3; - goto ask_now; - } - - /* At this point, we are at the leaf node that needs to be altered. */ - /* Exact fit, no nodes needed. */ - if (wr_mas.r_min == mas->index && wr_mas.r_max == mas->last) - return 0; - - mas_wr_end_piv(&wr_mas); - node_size = mas_wr_new_end(&wr_mas); - - /* Slot store, does not require additional nodes */ - if (node_size == mas->end) { - /* reuse node */ - if (!mt_in_rcu(mas->tree)) - return 0; - /* shifting boundary */ - if (wr_mas.offset_end - mas->offset == 1) - return 0; - } + int ret = 0; - if (node_size >= mt_slots[wr_mas.type]) { - /* Split, worst case for now. */ - request = 1 + mas_mt_height(mas) * 2; - goto ask_now; + mas_wr_preallocate(&wr_mas, entry, gfp); + if (mas_is_err(mas)) { + ret = xa_err(mas->node); + mas_destroy(mas); + mas_reset(mas); + return ret; } - /* New root needs a single node */ - if (unlikely(mte_is_root(mas->node))) - goto ask_now; - - /* Potential spanning rebalance collapsing a node, use worst-case */ - if (node_size - 1 <= mt_min_slots[wr_mas.type]) - request = mas_mt_height(mas) * 2 - 1; - - /* node store, slot store needs one node */ -ask_now: - mas_node_count_gfp(mas, request, gfp); mas->mas_flags |= MA_STATE_PREALLOC; - if (likely(!mas_is_err(mas))) - return 0; - - mas_set_alloc_req(mas, 0); - ret = xa_err(mas->node); - mas_reset(mas); - mas_destroy(mas); - mas_reset(mas); return ret; } EXPORT_SYMBOL_GPL(mas_preallocate); diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c index f1caf4bcf937..c57979de1576 100644 --- a/tools/testing/radix-tree/maple.c +++ b/tools/testing/radix-tree/maple.c @@ -36223,6 +36223,37 @@ static noinline void __init check_mtree_dup(struct maple_tree *mt) extern void test_kmem_cache_bulk(void); + + /* test to simulate expanding a vma from [0x7fffffffe000, 0x7ffffffff000) + * to [0x7ffde4ca1000, 0x7ffffffff000) and then shrinking the vma to + * [0x7ffde4ca1000, 0x7ffde4ca2000) + */ +static inline int check_vma_modification(struct maple_tree *mt) +{ + MA_STATE(mas, mt, 0, 0); + + /* vma with old start and old end */ + __mas_set_range(&mas, 0x7fffffffe000, 0x7ffffffff000 - 1); + mas_preallocate(&mas, xa_mk_value(1), GFP_KERNEL); + mas_store_prealloc(&mas, xa_mk_value(1)); + + /* next write occurs partly in previous range [0, 0x7fffffffe000)*/ + mas_prev_range(&mas, 0); + /* expand vma to {0x7ffde4ca1000, 0x7ffffffff000) */ + __mas_set_range(&mas, 0x7ffde4ca1000, 0x7ffffffff000 - 1); + mas_preallocate(&mas, xa_mk_value(1), GFP_KERNEL); + mas_store_prealloc(&mas, xa_mk_value(1)); + + /* shrink vma to [0x7ffde4ca1000, 7ffde4ca2000) */ + __mas_set_range(&mas, 0x7ffde4ca2000, 0x7ffffffff000 - 1); + mas_preallocate(&mas, NULL, GFP_KERNEL); + mas_store_prealloc(&mas, NULL); + mt_dump(mt, mt_dump_hex); + + return 0; +} + + void farmer_tests(void) { struct maple_node *node; @@ -36230,6 +36261,10 @@ void farmer_tests(void) mt_dump(&tree, mt_dump_dec); + mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE | MT_FLAGS_LOCK_EXTERN | MT_FLAGS_USE_RCU); + check_vma_modification(&tree); + mtree_destroy(&tree); + tree.ma_root = xa_mk_value(0); mt_dump(&tree, mt_dump_dec);