Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1028938rwd; Thu, 18 May 2023 07:07:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7kH7BxKQKrHodSy08DwO3FV3UCKRSqlyF8BPSOWP5nxBSB5Njxre9pfLEXmZQkei7quvxp X-Received: by 2002:a05:6a00:8ca:b0:646:c30d:e9c2 with SMTP id s10-20020a056a0008ca00b00646c30de9c2mr4694979pfu.28.1684418832760; Thu, 18 May 2023 07:07:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684418832; cv=pass; d=google.com; s=arc-20160816; b=Ve+00B/Rz/hMHHozY4dpTDixS+XyUNduZehpeZoh5Of53GQiddlog1ltldhzjGAbUs 7u1bMAMgala/J1s5JtBtGGI6aXnTnnKReuSgOzQRBpu+KYPR9loRuqjhl4MFOvZhYJbn p/3YUVjRFcMMKsaJMxM3XCthY3ynBJZfC5oyJKkVw8nDn73Ih0usLUuEv40CpsiC+6Wa G4N2zif4s88u4YCbEKq9KC7AkgwLO7FZTuFWvZzCoKhy+iG9nmSUM2xmHhD7ES9YFNS1 JcrOy+dCRrsOmqEWkfOEXtMi2lYT8mjYAQZHL8Jm8k/0q74YWKdPY/OPvbN0OqIJHBw1 kxfg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:in-reply-to :content-transfer-encoding:content-disposition:references :mail-followup-to:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=QFORs2U+/eH0oRvdR9e9xik5pZ5iMAZKN8FXBqbRt+c=; b=SqMnrEK8br7k2KB3biMVQjRjwLcYGpVJr4oj8xtgVKun+iszV7EVvRXVu4qdMZVxhx 5Nb4dKBmGvN99nm6I8AiFN0CqFXAZ5tFQg7j5ogaPnQujT52MRQ5RaiOA/7SYl4DDHdK myfaXTVkF4WhCLBi/vpT2NnfJFAY5qeCHXvgZF+69XzO1EL7XSe5Jg6lUeLhvj00kNdR h5V/CuR5sHDntaaaRE/KWVu7l3WUVIkyzYHSH8C9QBEgU2W9IPqoGYE0UfDoTQRqG8y6 KDep5Yau5oqNthWphVxH5qmFed/1ztL6fUVlr18BW9BufytBMdv1+DJkj4iK/zFNVrLE 8WzQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=3wMt5JHG; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pWP6GEts; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020aa793c2000000b0064667c16883si1745218pff.100.2023.05.18.07.06.59; Thu, 18 May 2023 07:07:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=3wMt5JHG; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pWP6GEts; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230153AbjERNrv (ORCPT + 99 others); Thu, 18 May 2023 09:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231398AbjERNrm (ORCPT ); Thu, 18 May 2023 09:47:42 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 377AAE5C for ; Thu, 18 May 2023 06:47:41 -0700 (PDT) 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 34I6JDIc018335; Thu, 18 May 2023 13:47:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : content-type : content-transfer-encoding : in-reply-to : mime-version; s=corp-2023-03-30; bh=QFORs2U+/eH0oRvdR9e9xik5pZ5iMAZKN8FXBqbRt+c=; b=3wMt5JHGaFWX4epxVJS+yVYQiu18UrXqwhuPfBkPUpeTZWZB1peftP2s0s6W93ut06Ay PJGe2+fT1PqsmDN2JRIMbzfBkl3mz5zCm/POPdySL3BYdRqa7LMQ03A070tCIZhT7pLo lWBGp3CcatAqyOxg19Y7Spx1COOcjqWTdupFLmuOMkBi9RVAuV+NvrvpS+fQ6Eg+kAg4 z/uz+bjqJ9A3G2BkDc3X1AtJ+HmXjFJzdwo1F58vw1AIgzuBlfF3saBvXdzg7oRtdmav JOtOEa46AfQ8P++/QMTBDqYBnarorq75JUOzQbpJzl7Nq9dE5fl1/HejvpXVntTsM8O+ bg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qmx8j2q69-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 May 2023 13:47:10 +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 34ICF7dk034011; Thu, 18 May 2023 13:47:09 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2046.outbound.protection.outlook.com [104.47.56.46]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qj1079g8y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 May 2023 13:47:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BJninrE4iNHS+u8TqGpyLy12Nybuyq6Z07z3WBHx0jwcfUZqmSZhxAK0l+dLvxPEyKPlCAjCmIDAq0Yak5gVVaeO7LggPDcdWlgljFXhn1pFgqQeUyBu6ELfV02gB5toOSK/wJlQJ3whYuq9bjm8uzvRvjs8qVX5q49oIbFVC+vaFbMu1oKlBfootj2TW1DhMY9Bc/xuX0lc4f7ivEZSR+Lnms2NnY0bAzi0gvVgnJ22d558SO6Q/sfaBlI7RdkvlwpZHn/1lKER2ZvdbWA/r+m/Bd5jyX5qRmBHUD3/Uq5Yj3qtMIEjXc5NxnfdCXtsruOLkUPb28B4XqGJldxHLA== 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=QFORs2U+/eH0oRvdR9e9xik5pZ5iMAZKN8FXBqbRt+c=; b=Wh+ucR8QIsbfypgZYeaxpBUqZF2S6/qlzPIJAJ2kOw3GGTlxhpPPNCdCwVsUu1n6gKWXSlSLe61LRmxxKB7Y15s9FHGFg9qYZlLPQIPk8AdEEW3JtahF/9PPG03w4CEVfksM7aiV7wpxLTOlbDvLqsYMN81DNssm8a4ZKlg5iqrp7bS0w1iFIilHKOvWsY85/plq72FOOU1Kn9aAWeLWd9PK1l0SGk8k2dIzG3z68h2e6909dCOWNGUsJcgirng+TwkQIZuUjwU6Od7hsJ2rbWWm/MhKT1sGwh/iJFIyL0eHCTi1fJXf2Yjy//y7VXoDJ2Xa99Dq+AG07VVza9B0kg== 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=QFORs2U+/eH0oRvdR9e9xik5pZ5iMAZKN8FXBqbRt+c=; b=pWP6GEts5ObjwhplB/47Dlic2YbOc2weIzZOOY0jTphQn055n7dK58oEFj+I7HdHr5kOrBfTqusE+8AJpCbhZqbZ54eavuXsf1AKAvSLYR1Vc9YXmNyx1fXOKc9TTxHm22Pv3lrT2OJEQxsFfthDLvj+kbKAPKI1OhSwVhe/MnE= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by CY5PR10MB6071.namprd10.prod.outlook.com (2603:10b6:930:39::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.19; Thu, 18 May 2023 13:47:07 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6411.017; Thu, 18 May 2023 13:47:07 +0000 Date: Thu, 18 May 2023 09:47:04 -0400 From: "Liam R. Howlett" To: Peng Zhang Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org Subject: Re: [PATCH v2 01/10] maple_tree: Rework mtree_alloc_{range,rrange}() Message-ID: <20230518134704.rve5v7jvpbuko5me@revolver> Mail-Followup-To: "Liam R. Howlett" , Peng Zhang , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org References: <20230517085809.86522-1-zhangpeng.00@bytedance.com> <20230517085809.86522-2-zhangpeng.00@bytedance.com> <20230517181705.rdfffvfhqzlsjjlm@revolver> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: User-Agent: NeoMutt/20220429 X-ClientProxiedBy: YT1P288CA0010.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01::23) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|CY5PR10MB6071:EE_ X-MS-Office365-Filtering-Correlation-Id: efec00f9-505f-4731-d9b3-08db57a65eb0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xiF6Waa4BKZEEP+1gNo5y0Z5FZRI8ohmk7e7WUFTWqMHGEWDrADR9wg450ss15pD//sHIjYQw56gQsOeLTz3PGWHm1WaQmJykgCiLhw3FVaktspytTEes2ai37HnrmjtGAPtLVX5cuFwpeNOtS6agdxnSbQ795nkxMCAdeHa0d4UsYk3VRIp+KR0p5x+dquuizZYHDuuZP6EZaRbeZ4HledGwwPwUaqwsQfCJFtZG8pnTq6jHaRL6hR9WrdExT3wS8BdyN5FpT7eyvPaZ7D0yC7Gq1RdtLH7gKI5/o1R5PjMgTLDRXWfWy/zJB2fvznj2UY/nGNTVRYVUuiaksd+zH32aprNqNYletoR5dQw/CKzfZrErWkL378S7QcUmHWVjXANSYbZtVIeqCikx/ZmSl/WFPKwtTLZsAL2QKbwy28JqRg/VodTTmvnZbVOrTW1El7hB8sDnyHt7RUGw1oUEAuBLNpxUqwLSnrOLi8rtU1cxV7ptZRhuNNRnmPTH68bH5wPI3OYpAVs4r7An7XHhdgfKiuWlMnB/DO3sLfx73ryp1rYMPdIiCz2UWNO2btL X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(7916004)(136003)(396003)(366004)(39860400002)(376002)(346002)(451199021)(2906002)(478600001)(316002)(8676002)(4326008)(8936002)(41300700001)(6916009)(6486002)(66556008)(66476007)(66946007)(5660300002)(6666004)(6506007)(26005)(1076003)(9686003)(6512007)(186003)(83380400001)(33716001)(86362001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N1J4ckhwR1RzN3hlQ2UwK2QzdmpoSXVmYTZLQS96cXhlMFhrWTAreFRhZm1G?= =?utf-8?B?N0d5dHJPUVlRejNlNGZPUEJoK1d0TzNsYkdoVUp3TXZuUVBmb05MYlB3ZHJk?= =?utf-8?B?RVkrZmpORXpwRWViZm50WDZIbHh4OTI4OGcxVnFHVGt4ZGY0a0pPNXlYNFZP?= =?utf-8?B?d2xUUWZ0OHdoM0NaNDdNL0pudy8zVFllSVlIRUVEM2lEbXNQZHU3Qm1NakFu?= =?utf-8?B?MjFCTlBEMm5rM1NKcWZCdVljVHNFbzIxMmo2amVUUDAvazlkRkh0Z1NtZmZh?= =?utf-8?B?bHRPT21Xb1hiNDlscEVOUDFJYTZXTU4xWnpZcXdBSjl6YnFCMWd5ay9ZRzV4?= =?utf-8?B?djZXSnVTb2lML2lEbFk2WGxxK21JU2t0Z1pEUDZzWGxFN0p1NzkydmJjSzVl?= =?utf-8?B?cW9BRjZkLzlTUzRhemlaYS9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pNmxRS0RzTTBsdU5kTWF6WkJOdGdOU1BhRFYrYmxNUUY0eXE5bzlMTWo2?= =?utf-8?B?VkVVNWJFYW0zbHQrdWxWdE5kUlpBMm9vMjRIVUxoa2FuNHU2OW1sUHJybkZN?= =?utf-8?B?amxCQ2RYZWVyd2piTHJ4OWw5WDlLYktyMXZYVVhHTDNuREcvUlE5K0RXQ2Yv?= =?utf-8?B?aDhsZ2wwT00rTVl1V1lKejBtdEdqcGJ0a0ZuUFFnWWxWeUdpK216WEdIKzV1?= =?utf-8?B?NUU4NXVSRE1TNW95TUpsMS9FRlBVdnBHWjB2ZjFmK0lGYllTV1prQlRwcGlk?= =?utf-8?B?U3QzWFJvc0lISndDbmQzWW40WExNQkxPMFR5US9INFo5T2dLazNERHJaYVBH?= =?utf-8?B?aTZJSFMwdmVoVzk1WDZqc0V1QlpKcFphVE9QRjRvV0Q2Rk5qMTNCbGZGVWow?= =?utf-8?Q?wxOtmp+ugb8ycCu?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: efec00f9-505f-4731-d9b3-08db57a65eb0 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2023 13:47:07.0134 (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: +at0gxyOcQ/V/3oboC5gfv3RuIVBTVZzGaZs38/iKbg//HIshlDTwp/FG8dq0zP1797EGIg4bqgGi0cnF7Maww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR10MB6071 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-18_11,2023-05-17_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 spamscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305180109 X-Proofpoint-GUID: QtTBpm7GhqXIZNGwDAfjlgCKmsurMVRy X-Proofpoint-ORIG-GUID: QtTBpm7GhqXIZNGwDAfjlgCKmsurMVRy X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Peng Zhang [230518 02:10]: >=20 >=20 > =E5=9C=A8 2023/5/18 02:17, Liam R. Howlett =E5=86=99=E9=81=93: > > * Peng Zhang [230517 04:58]: > > > Use mas_empty_area{_rev}() to refactor mtree_alloc_{range,rrange}() > > >=20 > > > Signed-off-by: Peng Zhang > > > --- > > > lib/maple_tree.c | 63 ++++++++++++++++++++++++---------------------= --- > > > 1 file changed, 32 insertions(+), 31 deletions(-) > > >=20 > > > diff --git a/lib/maple_tree.c b/lib/maple_tree.c > > > index 4eb220008f72..e1820e90f167 100644 > > > --- a/lib/maple_tree.c > > > +++ b/lib/maple_tree.c > > > @@ -6493,32 +6493,31 @@ int mtree_alloc_range(struct maple_tree *mt, = unsigned long *startp, > > > { > > > int ret =3D 0; > > > - MA_STATE(mas, mt, min, min); > > > + MA_STATE(mas, mt, 0, 0); > > > if (!mt_is_alloc(mt)) > > > return -EINVAL; > > > if (WARN_ON_ONCE(mt_is_reserved(entry))) > > > return -EINVAL; > > > - if (min > max) > > > - return -EINVAL; > > > - > > > - if (max < size) > > > - return -EINVAL; > > > - > > > - if (!size) > > > - return -EINVAL; > > > - > > > mtree_lock(mt); > > > retry: > > > - mas.offset =3D 0; > > > - mas.index =3D min; > > > - mas.last =3D max - size + 1; > > > - ret =3D mas_alloc(&mas, entry, size, startp); > > > - if (mas_nomem(&mas, gfp)) > > > - goto retry; > > > - > > > + ret =3D mas_empty_area(&mas, min, max, size); > > > + if (!ret) { > > > + mas_insert(&mas, entry); > > > + /* > > > + * mas_nomem() may release the lock, causing the allocated area > > > + * to be unavailable, so try to allocate a free area again. > > > + */ > > > + if (mas_nomem(&mas, gfp)) > > > + goto retry; > > > + } > > > mtree_unlock(mt); > > > + if (!ret) { > >=20 > > Checking for a mas_is_err() should probably be outside if (!ret) > > statement. If mas_insert() returns something besides ENOMEM, we will > > not detect the error. I'm not sure if this is possible today since thi= s > > should never return an -EEXISTS, but having it this way doesn't add muc= h > > to the overhead. > I don't think there will be error that can't be detected here. > In fact, there are two sources of errors: >=20 > 1. mas_empty_area(), the error number is in the variable ret, > and may also be in mas->node, but ret must contain all errors. >=20 > 2. mas_insert(), the error number is in mas->node >=20 > When we check errors, we should first check errors from > mas_empty_area(). If there is no error in mas_empty_area(), we > will check errors from mas_insert(). > So, mas_is_err() is inside the if (!ret) statement, no problem here. >=20 > Of course, even if mas_insert() returns -EEXISTS, it can be detected > under the current encoding, because "if (!ret)" is true in this case. > But I don't think this can happen, if it happens, it's a bug of maple > tree. Right, thanks. >=20 > I don't think it's good to put mas_is_err() outside, because the error > number stored in mas->node may come from mas_empty_area(). We should use > the ret variable to detect the error from mas_empty_area() first. Yeah, I would structure it as a 'goto' to undo the locking to avoid the if (!ret) nesting, and move the unlock to just before the return: if (ret) goto unlock; ... *startp =3D mas.index; unlock: mtree_unlock(mt); return ret; mas_empty_area() is an external interface and so already decodes the error in the node using mas_is_err(), so this can be dropped completely. I don't think holding the lock for the one extra assignment will make a difference. > >=20 > > > + if (mas_is_err(&mas)) > > > + return xa_err(mas.node); > > > + *startp =3D mas.index; > > > + } > > > return ret; > > > } > > > EXPORT_SYMBOL(mtree_alloc_range); > > > @@ -6529,29 +6528,31 @@ int mtree_alloc_rrange(struct maple_tree *mt,= unsigned long *startp, > > > { > > > int ret =3D 0; > > > - MA_STATE(mas, mt, min, max - size + 1); > > > + MA_STATE(mas, mt, 0, 0); > > > if (!mt_is_alloc(mt)) > > > return -EINVAL; > > > if (WARN_ON_ONCE(mt_is_reserved(entry))) > > > return -EINVAL; > > > - if (min > max) > > > - return -EINVAL; > > > - > > > - if (max < size - 1) > > > - return -EINVAL; > > > - > > > - if (!size) > > > - return -EINVAL; > > > - > > > mtree_lock(mt); > > > retry: > > > - ret =3D mas_rev_alloc(&mas, min, max, entry, size, startp); > > > - if (mas_nomem(&mas, gfp)) > > > - goto retry; > > > - > > > + ret =3D mas_empty_area_rev(&mas, min, max, size); > > > + if (!ret) { > > > + mas_insert(&mas, entry); > > > + /* > > > + * mas_nomem() may release the lock, causing the allocated area > > > + * to be unavailable, so try to allocate a free area again. > > > + */ > > > + if (mas_nomem(&mas, gfp)) > > > + goto retry; > > > + } > > > mtree_unlock(mt); > > > + if (!ret) { > >=20 > > Same here. > >=20 > > > + if (mas_is_err(&mas)) > > > + return xa_err(mas.node); > > > + *startp =3D mas.index; > > > + } > > > return ret; > > > } > > > EXPORT_SYMBOL(mtree_alloc_rrange); > > > --=20 > > > 2.20.1 > > >=20