From mboxrd@z Thu Jan 1 00:00:00 1970 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 EB224EEB57D for ; Mon, 11 Sep 2023 13:37:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 151296B029D; Mon, 11 Sep 2023 09:37:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0DAC66B029E; Mon, 11 Sep 2023 09:37:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E22186B029F; Mon, 11 Sep 2023 09:37:34 -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 CDE576B029D for ; Mon, 11 Sep 2023 09:37:34 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9A220120A79 for ; Mon, 11 Sep 2023 13:37:34 +0000 (UTC) X-FDA: 81224418828.18.473C52D Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf27.hostedemail.com (Postfix) with ESMTP id 2CDE540026 for ; Mon, 11 Sep 2023 13:37:31 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=kOZj5Uoj; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="u/DjBJ5c"; spf=pass (imf27.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=none) 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=1694439451; 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=zQRHZxc2cNe0/aT1OLeF48+IaXyaKO++elVWjVe08Wc=; b=dSV0nh3oWHhv/dH+k95ZwBC6CskHFe1STE1hysuxr4ptWOcdhh17aPQLTubExisLBEhpS7 IaKoxs6z/1mTfb21HqGw01A/9L7HilgXK6FxD/5G3EzN23fIQHr80cz/H2ITSpzmcZus+l wcrypeFlU6Upm3YvBiGdwgJzn5ZE2uc= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1694439451; a=rsa-sha256; cv=pass; b=zA5HC7kDEfEg2KEx4/1tpcqAFhbxe15P8aaORo9ndK52/1dnyaml5n/a5YOKwcHNZSiPhv V9EtnM2G7YWMdpX8SkenqGSj+cWHp0RPt6p4KAZ2mHzJnni7KjtabNFSb5xQeolzjeAR9g r2OgmY43htPfmnDl7RC05wZ7VG6bmSI= ARC-Authentication-Results: i=2; imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=kOZj5Uoj; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="u/DjBJ5c"; spf=pass (imf27.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38BChWKT028465; Mon, 11 Sep 2023 13:36:57 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=zQRHZxc2cNe0/aT1OLeF48+IaXyaKO++elVWjVe08Wc=; b=kOZj5UojGCOtsjQc7lzwS4rdobNvWvekoXasRo7qi5EKk9mevRK5ExuTOrhcnzPZiVkU NPpaEqOt+p+A+d9Q+9BjjJpb8Jjn2iJVp/EdiIYh39phJ+i+XBksTMBbbvnBLH4s5Dui LIh4ByOKcAUz8a3s4FVQQvu8Bqri0uf+B0MwEvzy81f1itycJqMUV67GRbPLnRs68Pq9 +uVCo3Z0T3oHFwoxWQxJR5RXos1f91Oma80yvE0o9+AMfPaPl0cg0FwpKjIGmtt6TQV9 pAecBU4i1iiTLrl/gYzAw1WmXymERvrNgJVm6Sqqx5wsczXUC7dP9ITs+sYAugid3uZ0 Ag== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t1jp79fne-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Sep 2023 13:36:57 +0000 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 38BBqNcF014716; Mon, 11 Sep 2023 13:36:56 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3t0f5afea3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Sep 2023 13:36:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J5HhwYRafUlKXEOzL0VJZhFlhN8FDwLRAK7V9Tsm3HI3N8SYa1tAUTdFaaq+Lda9caHno5057s/N1gNB1hOwikwvqljT2qo0n3u4DOu6MzgWNlU/2umC0gpcOOyz2PGnFcdF/EtVAUu/O/s8IgRvTDFHJNP760deHjsiySMzbh/2SHiKEmFCUwsXgqSMcUuqimdSpW5P9/MUpHrg3wN2WWmSVIvJ8T1zusE8rifgmkL1fxDgxPGHaQg8rblo/sN9goxB3UCFfWas4jEHF9INQpISNvxC6r4vdSGLZmBrbOAd2swdkrgiXUGaCbU5DenJkhpSdK1UtWiMT2ofezmZMg== 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=zQRHZxc2cNe0/aT1OLeF48+IaXyaKO++elVWjVe08Wc=; b=MxE7fRJ3BgyJap03PqYh6O3aMh+4nYRQo5XRebDZlmNIDImdZ+G+nWgqffXBsA+fFwhtF+ODfAXTxQSkGsj7nt8mGttfq1Ab0LZfP64VeppSLWlOAk/mzjSMC+ZWvx9+NRK7CQ3aItqb4Dyf1PWtxdxI1gtnBiRM/yRvIxpYyk27vBAcWkoVgHOGrTlaRk0oE4ttABWCYWaK+5bTXJVXkp6tRygG8QId82SI4p2BqRzdauLIZBuQPxgJUjfzSR+z0HQaSK9OJjkIq8Ev5TohS1Vwb3YMJy3mg8vc3VvTpY6D2Kmi352uh0hPPDHcALLJZoVtU9Is3OsBxQ9VVnbAMA== 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=zQRHZxc2cNe0/aT1OLeF48+IaXyaKO++elVWjVe08Wc=; b=u/DjBJ5chTFJHKkzJDnIUPLX6qj69QvISAdSFU5cjB8BzmmTRiBnbmxSlWER68VW4Y7qwviw68Mj/hjQ893ZBcIFNX6dHH/DhUJ2jCnJRpzuuhFRYz8VfGRiR3E03t+EooVRgzu/ddisCDEmhfh3//0pB0imjOGqY2IA1Cv3ETo= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6703.namprd10.prod.outlook.com (2603:10b6:8:139::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.35; Mon, 11 Sep 2023 13:36:54 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8979:3e3f:c3e0:8dfa]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8979:3e3f:c3e0:8dfa%4]) with mapi id 15.20.6768.029; Mon, 11 Sep 2023 13:36:54 +0000 Date: Mon, 11 Sep 2023 09:36:50 -0400 From: "Liam R. Howlett" To: Peng Zhang Cc: corbet@lwn.net, akpm@linux-foundation.org, willy@infradead.org, brauner@kernel.org, surenb@google.com, michael.christie@oracle.com, peterz@infradead.org, mathieu.desnoyers@efficios.com, npiggin@gmail.com, avagin@gmail.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2 2/6] maple_tree: Introduce interfaces __mt_dup() and mtree_dup() Message-ID: <20230911133650.6673xqdeunheebbl@revolver> Mail-Followup-To: "Liam R. Howlett" , Peng Zhang , corbet@lwn.net, akpm@linux-foundation.org, willy@infradead.org, brauner@kernel.org, surenb@google.com, michael.christie@oracle.com, peterz@infradead.org, mathieu.desnoyers@efficios.com, npiggin@gmail.com, avagin@gmail.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <20230830125654.21257-1-zhangpeng.00@bytedance.com> <20230830125654.21257-3-zhangpeng.00@bytedance.com> <20230907201333.nyydilmlbbf2wzf7@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: YT1PR01CA0134.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2f::13) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6703:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ee867ae-5607-41ec-4306-08dbb2cc2925 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 58gdbqQXIzovnNcSvTSqE6xrV8cfq6FNVLqLBzPxX9Nx0FuAIJd1aYIOalHDJDbSApNL4RDGbj5HvUWiVweL0byvg1hXjZHA3kximsUO97m7z0fU0hUddAK3wNRd2uaewty79FEtO6tAqKor6cFVN1eTN/IjLnTzJ+BT9iUT1SAgq+Mgzo7RzpsqfLzP73ANEfVSnozlLpM+QB7g6LGMd832WYEemlZMOBb9Dhpg3R/I1tyDIBbtt/jjX0CU49PwWU2ddQ74woy9W7bGis1ugaFCdFXO2gT6Y9LM1f63TLdKeQTwMNDwnPDPz7ldEukoUke0NkZVxZgiwRRw3RPin1uk3iQYcIJScApbwm/n8NjmuAHH4DmG1t0JOSu65lb9VC6Hz/Bf8AK6lnAnkaIcGhs6DwNLdgVx2zcVzDryCdk8MmIChz5FrCjOV8w8GnzdHCpriCjJDpcGAd9jn2bgFfV1k9s2iyeEaVuWLO3HDVQ8VHCxY7Wa1bjXw+Qa31N8RP97kR1oIUGYXekOg5CY9c1Qa8HvZu9EehXau1ZdmirVuBzUnepL7p+qiqKfW/Q7 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:(13230031)(7916004)(376002)(346002)(136003)(39860400002)(366004)(396003)(451199024)(1800799009)(186009)(6916009)(41300700001)(316002)(66476007)(6666004)(1076003)(86362001)(66946007)(7416002)(2906002)(4326008)(8676002)(30864003)(5660300002)(8936002)(478600001)(38100700002)(66556008)(6506007)(9686003)(6512007)(6486002)(33716001)(26005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Z2JnazM0UE9PSk5tcnJvUHZhVUw2VCtoNHdzMVkzZFUxd3hZUnp5VTZMaC9s?= =?utf-8?B?ekJkcFhzMWV2SHRhZTVYSEdmUVRsSm5lMklzbWNSYlEvWm1vNUIyVWE0cHRm?= =?utf-8?B?N21PNWk5a2toenZQZ2lCcFJlS1NxWHM2WnYzWGd2ZnRKK3FnYnQwc1JKdUow?= =?utf-8?B?eFBrWVBISUZ1ZWhpOGk0N0QwNDJxb3VSdm1CUjZiWUU2am1aOTBIRE1SSzl4?= =?utf-8?B?eEZIU0pndXlFRXB4YVVOa3p5K2p5eW53WnU0eXBtMlNYb200WmdFZ3dkNzU0?= =?utf-8?B?bXFWT1p6VDM0U1dFSjliaU13d29MakxoNmlRVWJqbHFNWFMzeGtIK0tScS9O?= =?utf-8?B?eGJOdzZVOGdjTERvclZncnBGY3ZnNXJhU0c4YTR3QU81U05WS2RGQWZsalRJ?= =?utf-8?B?WGkvbThSM2NjYjlMTXJwSG8wYmRmZURjSnBabW02NC9tT1FuTzFKQmhqV284?= =?utf-8?B?dlFaOVl5bUdTbHFLV3Bsam5MWnJweURUTW9tQVpsTWt0eUFWMW1RVU9SUG0w?= =?utf-8?B?ZHE2S0JNUnRnQzVoNXJCVjM1cE9kaEZRTVpuSGFUMTV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1NXp2amxrdjBIZ2wrQkVaWEp0NTVRd1ZOUVV4N2dLRTJ6UFNlSGdqMEt3?= =?utf-8?B?d3NkYnk5cCt6RGRhenJwSThvWnFDWmpZUnpMTXVjRXVEM05DYmNXSWF5WTg2?= =?utf-8?B?OXFvU2NNcjVUcUh5c0U2Q0pKZFMvMklteTFVZ0ZNNXUwQUVwNjRNaDZrRzBa?= =?utf-8?B?MnB1a0pnQ0MxcEFmakk5OGZsb0ZrSzBjV0VxWkpoSzZpWFVwOGFQZW9JNHhq?= =?utf-8?B?aXIzMkhzdkNLWHp5ejN2Mm94bVNrSGdEbEI2ZHA4Y0dNMHF2ZTdrVUtxVmx4?= =?utf-8?B?RkZxY0ZvOExBR1V2Mjg3eEp1RW5Pd3k5UmRJRHh2ZWVwc3J0M1ZmUzZuampV?= =?utf-8?B?Unk0WVc4ck5QL1MyT2JuMEFGSmI1dG1KME8wTitVeXlGL2NzWEFPUUZPQlBv?= =?utf-8?Q?OvN/QVie?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ee867ae-5607-41ec-4306-08dbb2cc2925 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2023 13:36:54.2662 (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: BAAKztwj1O98uFZpjYhqjd/qMGaIeoUZDwAc9F80n3xdUn52TML4LIUbjlZuVI58YhOP3bIO6nqvvNTq5Ha0jQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6703 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_08,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110124 X-Proofpoint-GUID: tUQVcLOIMoNWrwA2TGJuS1jdeQSW2oAU X-Proofpoint-ORIG-GUID: tUQVcLOIMoNWrwA2TGJuS1jdeQSW2oAU X-Rspamd-Queue-Id: 2CDE540026 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 8571egfc44wenr38kb5zsg1ps5uy1edu X-HE-Tag: 1694439451-728645 X-HE-Meta: U2FsdGVkX1/J7ak3a+KujRrCTcYxKkcKA6f2y1XcVKdtJ/WWLUqA9iC/BS07o7KybyIIqIo5Mupewo2UaSPqRSUjndmMiso9xZOl5qh5qk3V/fG079S/c3I1sZbHUVBk2H1gX/iPkJHOE2oWK8z/Mx42HbUf8iO+g7FWN0MYR05sySqqluDT1Xe2I7RMrYt3mFaXx0eh4h8/BukQVNUlq1jj16MgYLlex7bDvMgXzggQ/1aAH7Y1CfzT3UzbjcvlE2P4mvRKIyGngUxksgkxhLv3Giz6YyBeO7NYy1KtgnpAIW23Nfs26TLpByaZHtrbGGSLGNXzoOupU/jczt2PxZ4mWMtl+30P4kHdak7KA3FwUIawvOvC7oK1606/7Ln1EehGD6+PgvAP8HtsW7Bgi6oo+6sIIbWu6VxhcoEjWSTMwuFAPuIO2HsnKMvXp5qtRpKCh/H1xIr5DOyxjB7nHA/gsEyAyOGTbBPbxMKuDZ5Az5KmBK1+cg8sWB7EwMqa1jLz0Tw93PUvkG6LKMqurP22e9YzCwDB4mGmj7Jo4yHHOQb0XMfy3KWoNWyFTB20Z1OwUr2z2vMMNeIvVf1156xr9C1zXHIXUz3/NbDzUnbfSV3yYs5uSW+nulY1qQID7X+KQ6HX3Oi3vZJf/fZL+QaRVaWiGLJgWHNdmzurjnF73NyYkxLci8Nub/S0KMLxorc1HcqkytKoWmZTWaUu9c0ZlrdGi0zVSzAJ6wY9t6SEQ8gQjjhpW2C/QxKLVlR9lvt+zFgPbsFE5mfqe75KD6JNLMBQwdeqWGLL0ZTLJHt/8ZceY6/vqXDdk9RXAi5zggKPbL5NmwsuLriQHrbGkriujg5L+91ho5aB++BnVK6pnUi/DLymg4YrIHC/7eJUW+ueGUr6rtCiMg/Vm+V/m8kxMphlyFlVqohKD9W0ltRfMK7pKgemh5OOYljiLnenRYbeHhbK9YiDJATtDqP 2Odezue/ bZ0Lq3Yo2V46mnMjlAG7v40uCCVEZsS9rO611COItNKHr+kVn+kUKCqm0tXtN/2aZjSrO7S6R3BalB+au/hpXUT9qoCmMcftetCBv4C9LSUgvQxM8OjlsOxvCqkxMt8pkcoKwvmyPu7VqyePawJLu+fmXOBrK6aX55ZBcpBo3IxciY9UjNIi9LNQILa2ub+lRnTyKU/NYzC4jYtSn94raku7j4mKXQqj6lYJT6DAjDbutfV8jajjuLDPGnhKv3clYGncRbadWy0nLnRhZqXqfYeHKLK6KtyFqO/eZ2f+7kK4JCdpFfLXc0GqoW/NLGgkKU5dKLvjDt/EIo9/G7xK9izmHXwHeip+QtCwKxzHFd5fo9DPIl/Ezg/JCrx6SEFyKfweB7Gd3i/0RkDqgfNl4540eouqBca5F/iUxX691zGqvkiOyNFHmopNoj5XnZ80qS1CQGo1WwnTt4hJ5Ci3jo5NlPvw+SjHWGfSGy6MdmZZx8Fa58RTM9r+lUT0YBr2FqaoabULpXmDEdrwCSGiV2il61ctXVB/BjMm1+BbOvJX5Xyjuy4Ym9n8X4OpARZ3WcOXt7Wrd6f7LeacXIrVKsbr1pmC/7TdiwONz 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: * Peng Zhang [230911 08:59]: >=20 >=20 > =E5=9C=A8 2023/9/8 04:13, Liam R. Howlett =E5=86=99=E9=81=93: > > * Peng Zhang [230830 08:57]: > > > Introduce interfaces __mt_dup() and mtree_dup(), which are used to > > > duplicate a maple tree. Compared with traversing the source tree and > > > reinserting entry by entry in the new tree, it has better performance= . > > > The difference between __mt_dup() and mtree_dup() is that mtree_dup() > > > handles locks internally. > >=20 > > __mt_dup() should be called mas_dup() to indicate the advanced interfac= e > > which requires users to handle their own locks. > Changing to the mas_dup() interface may look like this: > mas_dup(mas_old, mas_new) >=20 > This still encounters the problem we discussed before. You expect both > mas_old and mas_new to point to the first element after the function > returns, but for_each_vma(vmi, mpnt) in dup_mmap() does not support > this, and will skip the first element. >=20 > Unless we have an iterator similar to "do {} while()", we have to reset > mas_new. There is still additional overhead in making both mas_old and > mas_new point to the first element, because mas will point to the last > node after dfs order traversal. I was only looking for the name change. Although, I think we could have written in a way to avoid skipping the first element. >=20 > In fact, I think mtree_dup() and __mt_dup() are enough. They seem to > match mtree_destroy() and __mt_destroy() very well. Underlines indicate > that users need to handle the lock themselves. I think you are correct, __mt_dup() doesn't take a maple state. Thanks for pointing that out. Please leave it the way you have it. > >=20 > > >=20 > > > Signed-off-by: Peng Zhang > > > --- > > > include/linux/maple_tree.h | 3 + > > > lib/maple_tree.c | 265 ++++++++++++++++++++++++++++++++++= +++ > > > 2 files changed, 268 insertions(+) > > >=20 > > > diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h > > > index e41c70ac7744..44fe8a57ecbd 100644 > > > --- a/include/linux/maple_tree.h > > > +++ b/include/linux/maple_tree.h > > > @@ -327,6 +327,9 @@ int mtree_store(struct maple_tree *mt, unsigned l= ong index, > > > void *entry, gfp_t gfp); > > > void *mtree_erase(struct maple_tree *mt, unsigned long index); > > > +int mtree_dup(struct maple_tree *mt, struct maple_tree *new, gfp_t g= fp); > > > +int __mt_dup(struct maple_tree *mt, struct maple_tree *new, gfp_t gf= p); > > > + > > > void mtree_destroy(struct maple_tree *mt); > > > void __mt_destroy(struct maple_tree *mt); > > > diff --git a/lib/maple_tree.c b/lib/maple_tree.c > > > index ef234cf02e3e..8f841682269c 100644 > > > --- a/lib/maple_tree.c > > > +++ b/lib/maple_tree.c > > > @@ -6370,6 +6370,271 @@ void *mtree_erase(struct maple_tree *mt, unsi= gned long index) > > > } > > > EXPORT_SYMBOL(mtree_erase); > > > +/* > > > + * mas_dup_free() - Free a half-constructed tree. > >=20 > > Maybe "Free an incomplete duplication of a tree" ? > >=20 > > > + * @mas: Points to the last node of the half-constructed tree. > >=20 > > Your use of "Points to" seems to indicate someone knows you are talking > > about a "maple state that has a node pointing to". Can this be made > > more clear? > > @mas: The maple state of a incomplete tree. > >=20 > > Then add a note that @mas->node points to the last successfully > > allocated node? > >=20 > > Or something along those lines. > >=20 > > > + * > > > + * This function frees all nodes starting from @mas->node in the rev= erse order > > > + * of mas_dup_build(). There is no need to hold the source tree lock= at this > > > + * time. > > > + */ > > > +static void mas_dup_free(struct ma_state *mas) > > > +{ > > > + struct maple_node *node; > > > + enum maple_type type; > > > + void __rcu **slots; > > > + unsigned char count, i; > > > + > > > + /* Maybe the first node allocation failed. */ > > > + if (!mas->node) > > > + return; > > > + > > > + while (!mte_is_root(mas->node)) { > > > + mas_ascend(mas); > > > + > > > + if (mas->offset) { > > > + mas->offset--; > > > + do { > > > + mas_descend(mas); > > > + mas->offset =3D mas_data_end(mas); > > > + } while (!mte_is_leaf(mas->node)); > >=20 > > Can you blindly descend and check !mte_is_leaf()? What happens when th= e > > tree duplication fails at random internal nodes? Maybe I missed how > > this cannot happen? > >=20 > > > + > > > + mas_ascend(mas); > > > + } > > > + > > > + node =3D mte_to_node(mas->node); > > > + type =3D mte_node_type(mas->node); > > > + slots =3D (void **)ma_slots(node, type); > > > + count =3D mas_data_end(mas) + 1; > > > + for (i =3D 0; i < count; i++) > > > + ((unsigned long *)slots)[i] &=3D ~MAPLE_NODE_MASK; > > > + > > > + mt_free_bulk(count, slots); > > > + } > >=20 > >=20 > > > + > > > + node =3D mte_to_node(mas->node); > > > + mt_free_one(node); > > > +} > > > + > > > +/* > > > + * mas_copy_node() - Copy a maple node and allocate child nodes. > >=20 > > if required. "..and allocate child nodes if required." > >=20 > > > + * @mas: Points to the source node. > > > + * @new_mas: Points to the new node. > > > + * @parent: The parent node of the new node. > > > + * @gfp: The GFP_FLAGS to use for allocations. > > > + * > > > + * Copy @mas->node to @new_mas->node, set @parent to be the parent o= f > > > + * @new_mas->node and allocate new child nodes for @new_mas->node. > > > + * If memory allocation fails, @mas is set to -ENOMEM. > > > + */ > > > +static inline void mas_copy_node(struct ma_state *mas, struct ma_sta= te *new_mas, > > > + struct maple_node *parent, gfp_t gfp) > > > +{ > > > + struct maple_node *node =3D mte_to_node(mas->node); > > > + struct maple_node *new_node =3D mte_to_node(new_mas->node); > > > + enum maple_type type; > > > + unsigned long val; > > > + unsigned char request, count, i; > > > + void __rcu **slots; > > > + void __rcu **new_slots; > > > + > > > + /* Copy the node completely. */ > > > + memcpy(new_node, node, sizeof(struct maple_node)); > > > + > > > + /* Update the parent node pointer. */ > > > + if (unlikely(ma_is_root(node))) > > > + val =3D MA_ROOT_PARENT; > > > + else > > > + val =3D (unsigned long)node->parent & MAPLE_NODE_MASK; > >=20 > > If you treat the root as special and outside the loop, then you can > > avoid the check for root for every non-root node. For root, you just > > need to copy and do this special parent thing before the main loop in > > mas_dup_build(). This will avoid an extra branch for each VMA over 14, > > so that would add up to a lot of instructions. > >=20 > > > + > > > + new_node->parent =3D ma_parent_ptr(val | (unsigned long)parent); > > > + > > > + if (mte_is_leaf(mas->node)) > > > + return; > >=20 > > You are checking here and in mas_dup_build() for the leaf, splitting th= e > > function into parent assignment and allocate would allow you to check > > once. Copy could be moved to the main loop or with the parent setting, > > depending on how you handle the root suggestion above. > >=20 > > > + > > > + /* Allocate memory for child nodes. */ > > > + type =3D mte_node_type(mas->node); > > > + new_slots =3D ma_slots(new_node, type); > > > + request =3D mas_data_end(mas) + 1; > > > + count =3D mt_alloc_bulk(gfp, request, new_slots); > > > + if (unlikely(count < request)) { > > > + if (count) > > > + mt_free_bulk(count, new_slots); > >=20 > > The new_slots will still contain the addresses of the freed nodes. > > Don't you need to clear it here to avoid a double free? Is there a > > test case for this in your testing? Again, I may have missed how this > > is not possible.. > >=20 > > > + mas_set_err(mas, -ENOMEM); > > > + return; > > > + } > > > + > > > + /* Restore node type information in slots. */ > > > + slots =3D ma_slots(node, type); > > > + for (i =3D 0; i < count; i++) > > > + ((unsigned long *)new_slots)[i] |=3D > > > + ((unsigned long)mt_slot_locked(mas->tree, slots, i) & > > > + MAPLE_NODE_MASK); > >=20 > > Can you expand this to multiple lines to make it more clear what is > > going on? > >=20 > > > +} > > > + > > > +/* > > > + * mas_dup_build() - Build a new maple tree from a source tree > > > + * @mas: The maple state of source tree. > > > + * @new_mas: The maple state of new tree. > > > + * @gfp: The GFP_FLAGS to use for allocations. > > > + * > > > + * This function builds a new tree in DFS preorder. If the memory al= location > > > + * fails, the error code -ENOMEM will be set in @mas, and @new_mas p= oints to the > > > + * last node. mas_dup_free() will free the half-constructed tree. > > > + * > > > + * Note that the attributes of the two trees must be exactly the sam= e, and the > > > + * new tree must be empty, otherwise -EINVAL will be returned. > > > + */ > > > +static inline void mas_dup_build(struct ma_state *mas, struct ma_sta= te *new_mas, > > > + gfp_t gfp) > > > +{ > > > + struct maple_node *node, *parent; > >=20 > > Could parent be struct maple_pnode? > >=20 > > > + struct maple_enode *root; > > > + enum maple_type type; > > > + > > > + if (unlikely(mt_attr(mas->tree) !=3D mt_attr(new_mas->tree)) || > > > + unlikely(!mtree_empty(new_mas->tree))) { > > > + mas_set_err(mas, -EINVAL); > > > + return; > > > + } > > > + > > > + mas_start(mas); > > > + if (mas_is_ptr(mas) || mas_is_none(mas)) { > > > + /* > > > + * The attributes of the two trees must be the same before this. > > > + * The following assignment makes them the same height. > > > + */ > > > + new_mas->tree->ma_flags =3D mas->tree->ma_flags; > > > + rcu_assign_pointer(new_mas->tree->ma_root, mas->tree->ma_root); > > > + return; > > > + } > > > + > > > + node =3D mt_alloc_one(gfp); > > > + if (!node) { > > > + new_mas->node =3D NULL; > >=20 > > We don't have checks around for node =3D=3D NULL, MAS_NONE would be a s= afer > > choice. It is unlikely that someone would dup the tree and fail then > > call something else, but I avoid setting node to NULL. > >=20 > > > + mas_set_err(mas, -ENOMEM); > > > + return; > > > + } > > > + > > > + type =3D mte_node_type(mas->node); > > > + root =3D mt_mk_node(node, type); > > > + new_mas->node =3D root; > > > + new_mas->min =3D 0; > > > + new_mas->max =3D ULONG_MAX; > > > + parent =3D ma_mnode_ptr(new_mas->tree); > > > + > > > + while (1) { > > > + mas_copy_node(mas, new_mas, parent, gfp); > > > + > > > + if (unlikely(mas_is_err(mas))) > > > + return; > > > + > > > + /* Once we reach a leaf, we need to ascend, or end the loop. */ > > > + if (mte_is_leaf(mas->node)) { > > > + if (mas->max =3D=3D ULONG_MAX) { > > > + new_mas->tree->ma_flags =3D mas->tree->ma_flags; > > > + rcu_assign_pointer(new_mas->tree->ma_root, > > > + mte_mk_root(root)); > > > + break; > >=20 > > If you move this to the end of the function, you can replace the same > > block above with a goto. That will avoid breaking the line up. > >=20 > > > + } > > > + > > > + do { > > > + /* > > > + * Must not at the root node, because we've > > > + * already end the loop when we reach the last > > > + * leaf. > > > + */ > >=20 > > I'm not sure what the comment above is trying to say. Do you mean "Thi= s > > won't reach the root node because the loop will break when the last lea= f > > is hit"? I don't think that is accurate.. it will hit the root node bu= t > > not the end of the root node, right? Anyways, the comment isn't clear > > so please have a look. > >=20 > > > + mas_ascend(mas); > > > + mas_ascend(new_mas); > > > + } while (mas->offset =3D=3D mas_data_end(mas)); > > > + > > > + mas->offset++; > > > + new_mas->offset++; > > > + } > > > + > > > + mas_descend(mas); > > > + parent =3D mte_to_node(new_mas->node); > > > + mas_descend(new_mas); > > > + mas->offset =3D 0; > > > + new_mas->offset =3D 0; > > > + } > > > +} > > > + > > > +/** > > > + * __mt_dup(): Duplicate a maple tree > > > + * @mt: The source maple tree > > > + * @new: The new maple tree > > > + * @gfp: The GFP_FLAGS to use for allocations > > > + * > > > + * This function duplicates a maple tree using a faster method than = traversing > > > + * the source tree and inserting entries into the new tree one by on= e. > >=20 > > Can you make this comment more about what your code does instead of the > > "one by one" description? > >=20 > > > + * The user needs to ensure that the attributes of the source tree a= nd the new > > > + * tree are the same, and the new tree needs to be an empty tree, ot= herwise > > > + * -EINVAL will be returned. > > > + * Note that the user needs to manually lock the source tree and the= new tree. > > > + * > > > + * Return: 0 on success, -ENOMEM if memory could not be allocated, -= EINVAL If > > > + * the attributes of the two trees are different or the new tree is = not an empty > > > + * tree. > > > + */ > > > +int __mt_dup(struct maple_tree *mt, struct maple_tree *new, gfp_t gf= p) > > > +{ > > > + int ret =3D 0; > > > + MA_STATE(mas, mt, 0, 0); > > > + MA_STATE(new_mas, new, 0, 0); > > > + > > > + mas_dup_build(&mas, &new_mas, gfp); > > > + > > > + if (unlikely(mas_is_err(&mas))) { > > > + ret =3D xa_err(mas.node); > > > + if (ret =3D=3D -ENOMEM) > > > + mas_dup_free(&new_mas); > > > + } > > > + > > > + return ret; > > > +} > > > +EXPORT_SYMBOL(__mt_dup); > > > + > > > +/** > > > + * mtree_dup(): Duplicate a maple tree > > > + * @mt: The source maple tree > > > + * @new: The new maple tree > > > + * @gfp: The GFP_FLAGS to use for allocations > > > + * > > > + * This function duplicates a maple tree using a faster method than = traversing > > > + * the source tree and inserting entries into the new tree one by on= e. > >=20 > > Again, it's more interesting to state it uses the DFS preorder copy. > >=20 > > It is also worth mentioning the superior allocation behaviour since tha= t > > is a desirable trait for many. In fact, you should add the allocation > > behaviour in your cover letter. > >=20 > > > + * The user needs to ensure that the attributes of the source tree a= nd the new > > > + * tree are the same, and the new tree needs to be an empty tree, ot= herwise > > > + * -EINVAL will be returned. > > > + * > > > + * Return: 0 on success, -ENOMEM if memory could not be allocated, -= EINVAL If > > > + * the attributes of the two trees are different or the new tree is = not an empty > > > + * tree. > > > + */ > > > +int mtree_dup(struct maple_tree *mt, struct maple_tree *new, gfp_t g= fp) > > > +{ > > > + int ret =3D 0; > > > + MA_STATE(mas, mt, 0, 0); > > > + MA_STATE(new_mas, new, 0, 0); > > > + > > > + mas_lock(&new_mas); > > > + mas_lock(&mas); > > > + > > > + mas_dup_build(&mas, &new_mas, gfp); > > > + mas_unlock(&mas); > > > + > > > + if (unlikely(mas_is_err(&mas))) { > > > + ret =3D xa_err(mas.node); > > > + if (ret =3D=3D -ENOMEM) > > > + mas_dup_free(&new_mas); > > > + } > > > + > > > + mas_unlock(&new_mas); > > > + > > > + return ret; > > > +} > > > +EXPORT_SYMBOL(mtree_dup); > > > + > > > /** > > > * __mt_destroy() - Walk and free all nodes of a locked maple tree. > > > * @mt: The maple tree > > > --=20 > > > 2.20.1 > > >=20