From patchwork Tue Jun 18 20:47:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13703079 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 C65C9C27C4F for ; Tue, 18 Jun 2024 21:49:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A38D8D006A; Tue, 18 Jun 2024 17:49:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EAB4C8D0066; Tue, 18 Jun 2024 17:48:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C38A48D006A; Tue, 18 Jun 2024 17:48:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8D4FE8D0066 for ; Tue, 18 Jun 2024 17:48:59 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3794FA1F59 for ; Tue, 18 Jun 2024 21:48:59 +0000 (UTC) X-FDA: 82245349998.15.9DCE25E Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf19.hostedemail.com (Postfix) with ESMTP id EB5841A0008 for ; Tue, 18 Jun 2024 21:48:55 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=F2sbfQE2; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=NkIiNNJB; spf=pass (imf19.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=reject) header.from=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=1718747330; 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=aXmVafrvMKS4PjtIoLGPmCZF41DcIZM3Vethint/D/Q=; b=HXPl0jLbHE3WqxywtRyMPntw820k99WeLze59csKPgZKsjw5u1LrxSO4tbUVZeoHVpSuXU GbQnH7ZCmPv2tqRYEEa1hhBggsVmHQve/ZfTt7WN9F0ZqNrd7SqONlFWDbR6tO8gD6pHt7 WIGsGxQsO9tEu7BaC4HST69rRh05rzU= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=F2sbfQE2; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=NkIiNNJB; spf=pass (imf19.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1718747330; a=rsa-sha256; cv=pass; b=iJB5zTjMzWEDDgHp+x5UouSzKZAE2WCdjruYsuxZipxrt7DjjaozwAUvos7iV0Q2v1vLOR ogf4vhXbEjfkiNOzcOIMJDvngbUkfPgHR5wpeu01GoxU0I/CTecGcSXiSH87n2coFFEc3k O0imh9q82IdWiFT6aeSJ0nThTocaqdk= Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45IIUxvX029821; Tue, 18 Jun 2024 20:48:36 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 :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=aXmVafrvMKS4PjtIoLGPmCZF41DcIZM3Vethint/D/Q=; b= F2sbfQE23/Djbel1sXOVF0pMOzc/UtfrP47/oZyw8RMWc7p2r4hSV5hwCDXh8pt3 Y24Ux5O+KEelLyuoZXbL9itv7kulkTrZNlVUO3W0VIr9RWrvnqk0daPhe9x6Nc0o x6WkIsyuDgR8XxQjovaloam0qCPj45eSrU+zAA0+nZfla42V97HG4za/hRLMh3+B HBo/a6pBzhuIakrsM9ZyR0RKMcwtFzDxphQxfGFVeYbEauylhySKdkXMzwktnJk1 2SpH9gGH5iDH7s5r2yA2hd6Tzdr+kkc/3elwa/d3JJsX+/Hny+W1zOFc3tED3zkh cggCynK9HwRYg6707VKI7g== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ys2js5tp8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jun 2024 20:48:36 +0000 (GMT) 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 45IJeuRg034707; Tue, 18 Jun 2024 20:48:35 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2040.outbound.protection.outlook.com [104.47.73.40]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ys1d8p6p6-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jun 2024 20:48:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZRUIkU2m8CBGAlC+hQcuAe1O3v4WB9gD9WJHkrfb63v6tuMEDcqvpBwWoBx037MywY2UID1qlQhRcR7Xpb2HeoDokHCuy7/FS2u6Z4xKH/5bQ5uWQWnn/r+9ZC3/16lHO5dNaW3juv3H6thpXRVOQYNCYwP2uF3s3DDX2ivDgvOqaccKNHmVDb+Gc/K5Hushlf2R57A2swxks7/wBDyjmo1YLG7V5oIn7LgCb0PvmCC8cQ9nvGIdhqR7F3FOFpjaZmtx7ZWKRwQlubU5ywIVZasDhn1wO23r/lTSV1e6of4yvQsA5i303HrTJ+WDuYVI0g6M2tFZHRMopq18qnC/Zw== 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=aXmVafrvMKS4PjtIoLGPmCZF41DcIZM3Vethint/D/Q=; b=E7dxgr6W3U+pmk8vD04w2Io+y+gxA6sV5vrD+8xiMuWxpOufM6RmV6eQizD0RboiWawOnwPGUGWh4tDgFsHFzwgz2JX3rCfwnRxO+rLudHO67sW/J+22xTDNyhIXBQ80eP/cXdtAy59V3oMBwWapRijVWWu7Vs/Bzw4K+YyFjxBY6hSwi75V022ZjesZuuPspUNJMn122e5LrS32vs5bN3PSkc8FKqPv1LD1DMCE0Qj2H59Ba28kvt4aDYyB45FC+a/cwxeaRAdSdioalyL4cRymqLHxLbQTIclQx2vspuVviuHqYJVm/9kmlLsBY8AXC+Sh/T4u8C2akPjsophVpg== 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=aXmVafrvMKS4PjtIoLGPmCZF41DcIZM3Vethint/D/Q=; b=NkIiNNJBq9pqbyt/oACdRG/B6bDXlPJjUavDsssroD+5K64uwwD398Py4hN/gSJpFEzpfRSujVVE6R9Ej2ltNpsUViBAqMBJILl73yEFSIB6cwjZtAA8HO723VKZLfe8yxj/5aX0ZqdjkIb4Hf5gHRF+6tiso9XH3px9idYrkPU= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by SJ0PR10MB5785.namprd10.prod.outlook.com (2603:10b6:a03:3d1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.31; Tue, 18 Jun 2024 20:48:07 +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.7677.030; Tue, 18 Jun 2024 20:48:07 +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, Sidhartha Kumar Subject: [PATCH v3 04/16] maple_tree: introduce mas_wr_store_type() Date: Tue, 18 Jun 2024 13:47:38 -0700 Message-ID: <20240618204750.79512-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240618204750.79512-1-sidhartha.kumar@oracle.com> References: <20240618204750.79512-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR03CA0154.namprd03.prod.outlook.com (2603:10b6:a03:338::9) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|SJ0PR10MB5785:EE_ X-MS-Office365-Filtering-Correlation-Id: b2d3583b-9d08-4097-33cc-08dc8fd7f556 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|1800799021|366013|376011; X-Microsoft-Antispam-Message-Info: cvJJKWxWcqk37KfFFIGef4CRs/cQJeRDqoEV86b8i07Uj773sYfa4JheMVXgh2LFGx7gAa8V4IqVQat7o6RpmKHnQuW5mzf6SNRqlRJhS3E+nJv7rw8P1NWb5f5ttHKKdoILkKM4tRl9LLR/6enuINz6gIMwO4phqVAf0yJm1KEqUS34cXPQrVjSNpNo50NM6FcmakQrx/Op6ZUEP/C6lQKh26pmrFB++i2+detOdTgNb7MSc1LWbtdOdsAKoDSXpcUiMTXEXNeMw+ImKnAq8g+vBRGG7h2T6YL1wQdmF6dLAVyKp7j9BBR6OgFvt7J/H4ImtfDWkdB23Q+5yFOtwnr2hps6TdovykKV/t7w7VZQn+3VQKZweKuxo5B11jhx5ZT5yqmcqLM6sZoAK+epRn3V+y7viUb2IWY1a1CH40wMWGaFkAVD3ehrMFLvta7cSeUbIZKtLOxTfdwA4AylkcJwYrjpulksH7pv/XQwYmzDiXsEIghqLjOTTaIEyDhDYSLA5u2ycsGHbaZEooqrjDaR6NzcEPZ3PeElOA5AXsnz9+7Av4ur9Ivzk+YntTbzZRrmRXks1VCvbelayf84WfJnlG+h20cUC79GnD4kf2SGH7imXhElU3/TLn85jz1oW63iFrppTmZzOgd6yCLi98foZ6EEWRpg4DjWONpFlsv55rkRqhSySBiopraNpMLjPKr2LxY8H3fcMwNHwihZA/8OOqPiiSqOt3km/hJW8AJ9XwdW50ZVh2iq1vgi948Jqw45pWZbFtwjQoGMlYAUKu2ZaD+44DVYLJdMOwOAgrbkX4Du4TBgwXFVqtSX8VxSP9XAG2ftREaSHMeTTf3VIw8e9USBUEVbaBR9VQ2jZtS+eXvRk14UaJTnAwN+o6bmQWfHq431D8AxGDUCY0zU6zyJgiY7do9mflWUkn4vsy/dzH/PI4Y51VS0bMQkKmAV3THbCXgSyKM5F28BFQxecTQFpZd4W/UWEdfZXIKBSvU7yDcu/A83vM1hc0Un+Ab2bC+9d3XkaChdtv2VkqcsAIqwFXglE6+jtdoHWQG/a9s9/yRNzfvxWmFErslwnqp/QfhaZA/26olMfY5xGorQFG2+RkfnGcgEd1o6vDu/mi/45NG3edjOQ7Hkluduln38Aqe5YwhrVR4ix7K5TSwRMbgBIIK+wt8yu/mYXiIjW8Ww4Uzw0jkpA6n8XRpnbw1zRWJZOlL7pABSEDZ+G3IXdUZQO+zE4KQLpfeXraz3+MEpV1EW9J+0mCYARzVnp0WN6tRUr+ro/4noCFMA/f2dIkvRYNVP9d3Vehhl3Wofi1hxjvxRgvHj75lPRe6DLRZh 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:(13230037)(1800799021)(366013)(376011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: En6L1ZgQHHFA1fPnQtLn6uDOIzpK/+kQmRcCO9kSeSS71O68/AzKMbupmCYLKU2hbJBnE8vbTsRu1WsivWHmdGM/9JotiqSiRgrlV42Smg0Vt/HsGTOJ0lbsXf8AXV5i2zDiGZ9NSuI8Nt3vQb6JvEz/5N2Cm2tlfFeqsAReWL/0L/SU/ddFkxiWHHCcg9YGrz31Tl65mAIwsVrPQ0dl/BM1lI8zhc/4ZSFDVKfZIPOaDwpMt55mncbNLTJpxBo+zFPNpECR9QtPWexjmOL6707RNAwrQqMQHt86G4iS6QvPZSLozVMdze/DtdBQjZp8I8kXuPFCYsbvFjCer5iIFNKXjAYS86vIGpM0RpTTm3rbfnbXWhFQv7wYpVtS3zeiK+rHQ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G63zcDbLkozS2NallXtMqy8cGwD3vFRN/2fWctjB6WIz1NorQrJr/i9s4ozszJt70L91Inz0wjqGAb4jNe8T15oZ4iNhxAQN6XvY+OuMKLSCEbpMfwZVKr9fMDiWofUAnIcCKEQRBOHoMRENiZnks704iMNxUo+jZt6mwjleE= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: SiAQF3kLcY4CmdHHXwPRlmqVgs4Wu0aKEwEX3PEkQexK5TeNhwLfOQ4rS6Kk4RXY2e6JWKSrUaRqua04NhSqdUylc1hSQ0/TmzdKHEWVaTleGBpbPAOlf8BOvU8SjWhvS1eiymsJQ9SD5FzEoZkCgyex07hu5TBcYqg+o0pOT5l8Lbj1EaFvw8E7BpakcSEbsRRac6NYUcHsqohoP2bGW35w66u/TOmBlqiT6k8Bzmd2J9kpjINAqIwzVF7s1yMohwkUCXA4rYkk7ynojhtocr+z2vXhkuIefW3LLc74f2HUiaJZx456aPfEB54j4o+0u96nL0SWh2yjRyxqIXalEQpHcfLxuftzbQgh1yHeX+tB0NpemwTlSHvMwgKVm8SV6Iez+8gZ0VHrMJPFpMhf7HuUatu7u5mlctte4R62BV32p1vp9K491/lnRLL5G86J5SS0x/ujP/KVYrKvPUYIOdNbxLYr8ZMWexWZzVka4RZdSGx2GqsKZq4lHNvo1OUFIj0QH1jRmc6WX2gvCiBF5dOnSii2N0eea3vymWjks955QSeYyemG/NrNyqkNJDCW6yGsvsUod+8eszc/wIw8sJOfjkkEYDREzNghBmSspPE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2d3583b-9d08-4097-33cc-08dc8fd7f556 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2024 20:48:07.8410 (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: 8lwbZLRZ9gyMaI6tC9Hf+PElH9eQXt6jc1/4qaBIPYTILyVtgOtEG5kccIuofCFguIaQPo7vgithLqzH6lO2ze/gSvlfpqNiwJyc1ccReog= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5785 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-18_04,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406180153 X-Proofpoint-ORIG-GUID: lSLopz7xQU6NG444sDHcpoAQNzAKjmka X-Proofpoint-GUID: lSLopz7xQU6NG444sDHcpoAQNzAKjmka X-Stat-Signature: jrmop4dq83pd836q4ipuu6nc1hrgbqt9 X-Rspam-User: X-Rspamd-Queue-Id: EB5841A0008 X-Rspamd-Server: rspam02 X-HE-Tag: 1718747335-707945 X-HE-Meta: U2FsdGVkX19MlJ15lFbtGL42d9u5/Mlv/U0WI9hytbJtaMVT9et9Y8RIcC3WvGd0LTFfMLd4MNVJ34zg3Y99VYoX5185FYhsYJPA7fNzdj1Gy3E+4KpNBc1LkH3tLqikHBmbsARPMTtg30nzQvCPgaG1bdqA0Se58Bsw7fy0mTnAAdzIFlKZDQpNdqRaz9ZccEi6UvrZph+8K2Kr2wiv8pRfAsVfqF2CW2qLVIHQRv/EZiDMVCpWQdBKiK26yTeFDmlmnRGdIDJ3H636kOGIBdy2Fd2ZL4zKkHXA3GZGGgqVzCAyG6zlWkzfvGEAhu2DD04f+1a9OT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Q7WCdwAO4987yI3s/71Ta3NxfS3uq7qEwRWFdf3hMDkCInJtFEPNWAyjUzc4swPp87jvFyD7STWFZwdxgZl/O3NhA== 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. In this change a call to mas_reset() is removed in the error case of mas_prealloc(). This is only needed in the MA_STATE_REBALANCE case of mas_destroy(). We can move the call to mas_reset() directly to mas_destroy(). Also, add a test case to validate the order that we check the store type in is correct. This test models a vma expanding and then shrinking which is part of the boot process. Signed-off-by: Sidhartha Kumar --- lib/maple_tree.c | 214 ++++++++++++++++++++++--------- tools/testing/radix-tree/maple.c | 36 ++++++ 2 files changed, 190 insertions(+), 60 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 62b465f0d97d..5187f0b19742 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4275,6 +4275,151 @@ 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 + * @entry: The entry to store into the tree + * + * 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 @@ -5503,69 +5648,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); @@ -5591,7 +5684,8 @@ void mas_destroy(struct ma_state *mas) */ if (mas->mas_flags & MA_STATE_REBALANCE) { unsigned char end; - + if (mas_is_err(mas)) + mas_reset(mas); mas_start(mas); mtree_range_walk(mas); end = mas->end + 1; diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c index f1caf4bcf937..2c4e69591235 100644 --- a/tools/testing/radix-tree/maple.c +++ b/tools/testing/radix-tree/maple.c @@ -36223,6 +36223,38 @@ 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); + + mtree_lock(mt); + /* 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); + + mas_destroy(&mas); + mtree_unlock(mt); + return 0; +} + void farmer_tests(void) { struct maple_node *node; @@ -36230,6 +36262,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);