From patchwork Tue Jun 18 20:47:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13703029 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 8C30CC2BA15 for ; Tue, 18 Jun 2024 20:49:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 441B68D0056; Tue, 18 Jun 2024 16:48:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 30C148D005E; Tue, 18 Jun 2024 16:48:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E32268D005A; Tue, 18 Jun 2024 16:48:44 -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 8F99A8D0056 for ; Tue, 18 Jun 2024 16:48:44 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4A425C0B63 for ; Tue, 18 Jun 2024 20:48:44 +0000 (UTC) X-FDA: 82245198168.24.6B5729A Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf19.hostedemail.com (Postfix) with ESMTP id 046E31A0010 for ; Tue, 18 Jun 2024 20:48:40 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=JIGpGgOT; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rBFtIlqC; arc=pass ("microsoft.com:s=arcselector9901:i=1"); 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-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718743714; 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=XP1A/eOgqZMUlcJAiPY9f3/4Q3XZGbvXKJ9jT8yEgaw=; b=SsuCyXMYkxBEOERF76ob58B4bUxjnCKNEQJD6jxA0QUAqrzuT2hf7TAD3c6U+kilqbeIts WbBQv6ADEtyLxjBA27UdqrpSMENqUkSr7qgRSsz7lnNqQpYX+5bERR8Y9SPPENrvWJkaOq G+IdjVrrDM4Mko8haQWoMUJBnPYoVUc= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1718743714; a=rsa-sha256; cv=pass; b=lJUZGcVT8BdflEcI6nrKKNkP6Jop7tvNfc4MkU2IdoXWVpnfkDjEmAcA71A15Zz7RRCHAG y+1Z7Pyl5iyaGrw3SwJMfWerv/V7DZW05mq63Xy/kRLDgMLfCtvr1TKbWYn/az0KJ5aMRZ AP63ouG2QHJiozPTloTyjzbiLvVkcpM= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=JIGpGgOT; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rBFtIlqC; arc=pass ("microsoft.com:s=arcselector9901:i=1"); 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 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 45IIUskA029791; Tue, 18 Jun 2024 20:48:33 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=XP1A/eOgqZMUlcJAiPY9f3/4Q3XZGbvXKJ9jT8yEgaw=; b= JIGpGgOToHk5TqsBKqvuA39BrY812xcbxW0mUOglbpz4Mt+brlJ0JcaiYMGKHfEE Mk+iShgr61A9E3ozq3azP5opMorm9icrwjTNS9Qgp2+tuSMNRlq1smChEMd+MqvL 0dBz4iLxq1/27hxjfdAIK8qoSf6lU1d7Sncczz4y+Jhnn7793aGfa4+jgyi8L+nc ZcmwASlFdKgKyQ8rVMQ93YQefAPWw4KNhJPn5HYQ4Go09RY0F1ZCY6Phs5ySSMM0 I3Wgt8czMO/udVoOpqKBi1mt/UAzqJrJ8GBStXmH1tH6YpsR/KnuNMjfDfeoPXlX FUT+Sa41texVdNhPs3OZ0A== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ys2js5tnr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jun 2024 20:48:33 +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 45IJlTIR034656; Tue, 18 Jun 2024 20:48:32 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ys1dey4ud-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jun 2024 20:48:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NH7X9j0E3CqffwXX+OTU30Bvv/M0DM2SH/aGy1RJjGzrQmZeA3X28k088KIiMe6oc0DbP5NcCvjsF2MCUYsdSmKeVUYZ+eIwIJan/mChMp3zMOeaRfBZeLxuvy0Z1zEqB/LSC4hIPlW+iH2ek4xtmT1SpC+S4iJdlOcYUJJqsY9meLHMOGgnupsGK7eXjsn7kiF61j2CqZqoE2BhrL44vg3CIJ0eEnG1RVdpqgG5ptzZLM0ywFOo9XbhvDaV8p+P6/2qupkhCXFVTrLjitUQUnlrYD1Giv86iNs3lxLpF7l4immxhH5QCDYYdboJxhUsNJF7R3bl/yt3rgTrGp1CnA== 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=XP1A/eOgqZMUlcJAiPY9f3/4Q3XZGbvXKJ9jT8yEgaw=; b=QLTLcdOOIEnAxgyMR+ulGCudhNUG4jF3YIKHcFTdcoOvo7SAXLf9PwKRUb6ah3gMhuWTEqdne9qLUn2KEtBlHPXagEmZnXs0ITX9ZawDDNORUKAsYcM1QNXAfW3XrfHsWj5JdwyPcptmjVCRgNk7rPhdKwW+oDYrLSpmlJ0Stq7WE9tGDsuFTvjU+LS+y5EwohCGG6GPTcIpwX0PsplYKAjjxgHBsAguYvvxLsQAqL+LEwG9uX4drEX2JOldNI9ei3NVPYlGeMMk3oY7PzyAEjzjYzI6dxdY0bkSHmCBrzMRMp5R6sQ4ML5qtCV9dIoTIxEGLdN9uoYknSaOy7I6Ig== 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=XP1A/eOgqZMUlcJAiPY9f3/4Q3XZGbvXKJ9jT8yEgaw=; b=rBFtIlqC84DmUz++KjIlHY8YKJQ41LuHYmTlkPdweeddFtXtS6iKGlWJvlfCQAzFsckJ7DhlHT0NNobktCBxwpxRnEv9uSB+zUtRKgFT7eIiAVLKcNPL4KYZ5Ih70LUstdy4eXr0WrpxURKy+eQCVVjlR+AhllY2KtxeVGeVsdE= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CY8PR10MB6465.namprd10.prod.outlook.com (2603:10b6:930:63::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Tue, 18 Jun 2024 20:48:20 +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:20 +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 10/16] maple_tree: convert mas_insert() to preallocate nodes Date: Tue, 18 Jun 2024 13:47:44 -0700 Message-ID: <20240618204750.79512-11-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: MN2PR18CA0008.namprd18.prod.outlook.com (2603:10b6:208:23c::13) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CY8PR10MB6465:EE_ X-MS-Office365-Filtering-Correlation-Id: 75c68de6-2d5b-4b5c-746b-08dc8fd7fd06 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|366013|376011|1800799021; X-Microsoft-Antispam-Message-Info: wqhTsmTk18wjRiulcUEBAqsAPppw3E8eP1U5P+M0qIcKzvaHHdi3mqYgi4aLU4STxl3CTKfNK3D/I7c/bhX35fpZQ6wlQJkoAOOQc55lVAx20u6UQKabeBS4TPJUxCVuQu2w4Ki7IWVDr/z0B3CwUsqZOskY/kBMcR7ARkbSlGQf8iThCJKAs0q0je1dcsZ8z0e7CoPPvn5DergQegQCZv2ahE+j2pVM5YwMPdM0kC8BFriiCn9m9pXH4gSaQ5qlyno6Ivw8b2kIWV6kcAr06uzj8/K1eAF5O0oiPcGM/s21GhkoqUpxanSWb2LUG85WeL7jD/dgVgly2FvconcUkIK69E+XtYW3tPt9bxHWkCVom3VQvD896D14kygBdaqVlm+v/ZVIoiQz0G+2DmvnypF2XrJueXpD/xujUkcbCuczAyqZNtZPXOZO5Wd6Lr9rvSFaTueWgq1cj3hix2ZE1+2Z3Q4bJrB2bTfAy6XG3sCX0hltsmdr3PBeM8h9zf1AfwB+AyBfe6Y6tsPViAWruWzDi0FVZmYKJ9dfpmbvl5tzKNmOoDmwwCGjauspzZfSaAwd9VvG5OxWSrHCoAy8VHCV57aCG6Vnwu/jjYGjXOlz1M6Dm9LpqSnFNkrixnQ17J11OZ29N6/bVDxfis/5HK9I5SY0E/wnoIXEFqzOxKe19jlQa+hYmfBaqcj022DS23TFCZFALJnduBf7pykNqgorWab7IvxksK3XRUch/VdfvvRbQqJtEiV1ozIJS0RJLL2frsN2WVaeerXFT57pqvP3ExEDNRFEaIMmGx8HPGPMhhpAuNSuGQV9nYqhks0h/ACtoLyVtRP+/RGzro7+j8kl/xPZc1ay8SpwRd85r1dqG6RwLuNLleA3nEP+6eOVpQHOVpIIw7YYJLY09yjRArKjlJGLF4TxK0+YWxt3LevVFtdIr79M5Ut9FFM2goWNR59gpFdfE/PPXK+8G6McgEGRSMhzWjKdmuFdCDQVXAcfbajsIodq/Mi/ap26g+ipvuJsxFxclL9F1IUIA1xT9BKcrjsbkwkTok4dA+9u3x/t1XtFejC3/lmqEWag3AK/0A96cH6HG9rmXEaC43EKdhL+rI3QQjMfV6vntipd6ykxx6tRx+MG2C2jSlk6nTi+6VeXybMq9tkIy9vSCFzkp1kB8E6dKiB0GyxfQaAnrYuICLgFzyjnP9y606nTY0L1WGsP5MiFF27lOmE6npB2vkRDdtb3XWemUrXKRconGoZoPouoR1A3CKkSnMo6Ie00zoAjnlLICg48hQcbQsgyLTaDatn2pxDH3tyBPUTe+48laOAGCzKI8JN+64WP+anr 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)(366013)(376011)(1800799021);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gdFM4k3f4CR9MZvxoloUjsq/6ie+PjdIWyUB2vpF+wD9zSh7z1RtznP19ZcaxmXyBvHlfbLsIyLIn6O5qFVCccHGDZGZiexEoxZ9IPFLUluY0CDOqWMHQOmliBKnZkbeA1aQAhDzkgYEkdPxK+BWOYeDxvEZ+VPyd0jcYf+4vsUbntfBXtGrX1mPp4hIXEWHfYkBtV/pwVBfscMoPy/QDpAKie3Q2DuRUnsYPNN9fh6dvEyp+rL113qzTM5sDTSRQs2y3lh9Z1Gl3h/LkYnDPXxFFcnYadIiWHihydqBHsbEKxWIgnftKIjsw7VuOuygXNHQHLWFPfPaZ7BUREc/G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w72/KtRGjLNKxmJaOmJ0ZEgW2nh7PGHQOxUw1SW6NovLTR6yxyfD/q5XTyb920U/bXFu04Jn63LkS/7F94aZcnpgj5I+/mXY8XgSsW59aODDpaFaVBzyQyqlTxriMXRcsDnGAGfBADbHeKMmKIj+RQ1YB+O0nZwbMhSEKPrZ74bUWNSFMdk6N5apH7+MJhB6oKXxemlq6nOyCpVojDm11KXp+R+z9eHtZVs= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: QCRWEwd/Aeoi80yk5n1Rq3oGfANY0MgipNU58d7dkSaa57woqxKO1cCgHpKnEc8Ne7dFmFHC68BLnXrmhpsr5otgCFrOAdlEBVynHlkiu3aOCiOrAHNv8xfMXpkX/czqYP6S4889olnWh6G3ZI3Z0qdgyE8ZieWI6yjz+f5Bu26/Rtfz/8N/1dVa2aNTPDiuDD2YrDAinS80v9lfVEKkyCrJrOI4GFxzL4pZY/mrh70IpAraxKD499jH+IFsnBUujTmMibhI+Rxf4oCEeedLdYdaTVcdEqxEBId8zPSpgrbComQ9Aj3hW2aTpprPpQWDIVJfH7Tx+cOrN9Kn9ommQszc0ruMewmFF7/VD66sq+7wPZHZje4BeIAG/ho7DN0FzQNpVjGMGRjirnJ1D2IJEFTJuSgf10Fh0hDAOHsQwFIWePdQk9IlAgXpfXjqYV5uD4Ug6W7tfyDV/SCOPO5ZK2FSzteCjbxgbZT2lDuTr2EN5IBXBw0e9+dqiag4yXfB6Q+ttw4eIkHcG25spJiNY8ld07zW5W5qxkPUCo7IcWrCMfQhJeRzOxyvdF1xzKG0wJmUQqfVJ3sZ/sknqy0vDA6loV7ZMypRQPc7ggb/NjE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75c68de6-2d5b-4b5c-746b-08dc8fd7fd06 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:20.7041 (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: sqvfdGBMpDr2gbQY+xp6kac7IxrwkVKSdpPTCPp7eGyeN2tnt4f6qfsUG23mBrwx5WaSYXCo/Djc4iD/wZ1ApVzHwUNhsBx+myNV0VlcR7o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6465 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 suspectscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 malwarescore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406180153 X-Proofpoint-ORIG-GUID: ZwZ1nuokKgIBl60Brqr4t0OFppMXuFhm X-Proofpoint-GUID: ZwZ1nuokKgIBl60Brqr4t0OFppMXuFhm X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 046E31A0010 X-Stat-Signature: 7t61af3x8j1y896ytri719ukxnomquxb X-HE-Tag: 1718743720-385927 X-HE-Meta: U2FsdGVkX1806hXaerqc69brmsmE+pbGRquZOILSwnap/DkUORAOxxfrJTuAtcGMKkrvZvYHLjBjXofdV/HnU9/Ho4VOj+uuws95tgP9L0D6p7huFGV4ASYrY/gQV7d50elcfbT5YnC7MMzxzQhJhF/0wSJ6kOp7mJHTifTFxtbMKSvLOmBBKho+4KaWgmLkMMW7AqNvaPJnf+4S4TpDonSsxA7gmI3bElFROqVSkrMa5GGxYGc/E64QIdTRBy+b7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uFxofBaueqT+qiPNgyccbQqQUEVVGPpb1ouhd8BSDNvchm5Ht/3Mo+psj0rHwMIv814+5ridV6QG+t8D+pfXggiDzmeENV3HxYlYoAAw== 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 | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 8ae87e512961..e53f1f398ece 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4442,11 +4442,12 @@ static inline void mas_wr_preallocate(struct ma_wr_state *wr_mas, void *entry, g * mas_insert() - Internal call to insert a value * @mas: The maple state * @entry: The entry to store + * @gfp: The GFP_FLAGS to use for allocations * * 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); @@ -4468,26 +4469,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: @@ -4532,7 +4531,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); @@ -6536,7 +6535,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; @@ -6585,7 +6584,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. @@ -6667,7 +6666,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.