Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp878146rdg; Wed, 11 Oct 2023 08:01:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6IW5FmEiKITKdd2/os5LpuWC8GM45KVHvGpQN8c2n5W8v8g115mmiyTv8FSlaGeJ4mqdT X-Received: by 2002:a17:903:41c1:b0:1c3:c687:478c with SMTP id u1-20020a17090341c100b001c3c687478cmr28520476ple.8.1697036474210; Wed, 11 Oct 2023 08:01:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697036474; cv=pass; d=google.com; s=arc-20160816; b=Uw93cTqtim35EzcOR3QgskiPFhSdye8RYKA4CG4eM8Efb9BAiGNYryzcfbBZKKDGFY /ZIMw/g+HqvpCuNFtN/iCIAUgP+d1gbg83ENoSpqJD6dm0Pbj+2nny2n8r/o8n18q5FJ 7Yxqv1+Q/IueK/F5De0des7PK8/pX0cz3TQLch+XhxWUWdPR+WqDZUxyznNSLiAebK5t F6oISGc29K6jpIZejYIwQjA/f+/7ANT0W0FQVUPoWN8Y1rdkz+8U7BRV2Q4GqKRAblfP Bfvt9zKH8j4zCv93pLnoUYxNDunX2VuXeJSrYpqXS5ErlL604onh8XBrFizYCwPfjPR5 S7Nw== 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=WIGYjJQ1MhXb7driI4EKm4nRsaeEzDcFW9nQfNUEZ6o=; fh=2gqL587YXNpoMHdAXqA6pOd4Cu4I0VOTPT5CngFrBoQ=; b=LoJIKYZHpieYB+SDgTV7im9GBE/vfhF65ICVHSOms3j9eza2rre5KJLR2KiedJ6hY/ 2MLMbxNj0zjxaF9/dd65JANPnUZDY80TFISF2ipxzpoi1pTr95e3HOQs9gzY0PJJ1+zY O4smEyzJ1L0QE8p+ZURdNT/ehgDDnKAEdYqKw+PLaeYB80QcTOJKoYzveq7Sv+zkhQsU 6udHiaoIcsOP6x1L2MIyhnygD5SB5JzaiByVRtEZAIHxT46txhIl0AJuEx4PoCq9jVLo T98Tg06Lx2LYNvup9fLxCcz0uGyWJekNMQJT0UU5nx6wg1E0QbveIBNxV5PHGIDBun5b T5OA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=gv8dj55C; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=A1cbBGIS; 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::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id l9-20020a170903244900b001c77a0c5a61si15289632pls.551.2023.10.11.08.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 08:01:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=gv8dj55C; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=A1cbBGIS; 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::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 12BB581653A2; Wed, 11 Oct 2023 08:01:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232656AbjJKPBA (ORCPT + 99 others); Wed, 11 Oct 2023 11:01:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232506AbjJKPA6 (ORCPT ); Wed, 11 Oct 2023 11:00:58 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB0AFB6; Wed, 11 Oct 2023 08:00:51 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39BEd2sB006050; Wed, 11 Oct 2023 14:59:58 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=WIGYjJQ1MhXb7driI4EKm4nRsaeEzDcFW9nQfNUEZ6o=; b=gv8dj55CYZva5HLZdR8rxJ7x85N/OO2nGXzBOfVWTQCGYzygB8YcvjVriPv1rIfzqFRR jWp8zaZNtVwThw1b+K++o2iRId/PfNQvZZmabsNK9jU4ajxgskbGXD/Tp0XeJoPmooL/ xz9C6YNfTJ0rFN50Dl1Q48xjkgfBG2U7wu2iZRokXNa8Va8AyfyCOAemVfsgT4VTfFTP k8DgVOXhzYfewusiLsmnb9Ub0hUpcBHk4WEFAkJ37RZ7cvWEoANQYL9koyCsdttzaUCj r1d3Lx2GEa9mMX0TiuhtMgb+XhbtbaMi0FTWkAe6KzPhPNBT4/fS0zobI7obOFlvJ4M2 Tw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tmh89wd6p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Oct 2023 14:59:58 +0000 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 39BEBTSw004744; Wed, 11 Oct 2023 14:59:57 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3tjws8hfby-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Oct 2023 14:59:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VxCNLl+8ewk5a2G0rX6a1VB/ZueJORal9XUivCfYN6DrkctJHRWh2YZtDygDXQI0Kht7hrhsg59grvkdD5BfjQtmiW5ZPbyCNzR2Kgb1ZMhpOpf2TZSSBXuKlxEtwn4zuejWkbvN6wSXG3aDMiFv9EJF86JVQiewZUQTJnk1yq4WuFmoCnwyj9SyWHvDWVp/5EwU55rFiY+xk+wGK5/qryOBD8NPvwuUXChqbjFeNzIRUaZ7Z7rrDBSzfVXxJkLdN3eqXYkctG9oPwKH9+iLD+fXr977lmAAKYNvBk0eD+Fx0eqTL67VQzlUo2sPD5mFGmk+XzuLXSaJVCBohuc3DQ== 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=WIGYjJQ1MhXb7driI4EKm4nRsaeEzDcFW9nQfNUEZ6o=; b=gdgvsHXMVTbWWpaKx2kFyOamEQ2FVButHJO3f36mvL8gqyYzAbojt+wHQivMDFYCPYX5NsiEaE8ZIqvzsziCFeocnrQ0ST4++h4uuWWc/GSpZSCCEsjNqUB0+fl0UKA//Ar6swCnB2t8FjWaHamoah0glIfGMEys8Z1RzqQHhyew8o1sIBrySCbuGRDjmEPkgFs+WSR94jjhRWFGQuCkABMjBYespe6pgej2YLTAsbJZr64uxo1cm68tuYcOA8oyeR9fqm/n9TsgyLDS1/P0sozo7wHKTCIyNYFUmMOSUxXE3sFbm1Ecf6vuZZTy6TLUfOc5PRFcd/aJaHMSqgRJTQ== 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=WIGYjJQ1MhXb7driI4EKm4nRsaeEzDcFW9nQfNUEZ6o=; b=A1cbBGISl30J9b2ODE12Jb4OPMTW/VXBTpEIUZnED0wlsiHftvQoVlGUgMcNHWQhiGSg0jwSU3ltqWqvKDv3NnaAQE2k3HG9ySpSOR8UsG0w1LUXs0RTeZSOAyQnbNF9/BzRUWoc1sW5JKFQQS2cz8FWBVMsvdEbZ9zKWa6ONkw= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by CH0PR10MB5259.namprd10.prod.outlook.com (2603:10b6:610:c2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.44; Wed, 11 Oct 2023 14:59: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.6863.032; Wed, 11 Oct 2023 14:59:54 +0000 Date: Wed, 11 Oct 2023 10:59: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, mjguzik@gmail.com, mathieu.desnoyers@efficios.com, npiggin@gmail.com, peterz@infradead.org, oliver.sang@intel.com, mst@redhat.com, maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v4 10/10] fork: Use __mt_dup() to duplicate maple tree in dup_mmap() Message-ID: <20231011145950.6ypjrfgkngukbjyr@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, mjguzik@gmail.com, mathieu.desnoyers@efficios.com, npiggin@gmail.com, peterz@infradead.org, oliver.sang@intel.com, mst@redhat.com, maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <20231009090320.64565-1-zhangpeng.00@bytedance.com> <20231009090320.64565-11-zhangpeng.00@bytedance.com> <20231011012849.3awzg5sfdk3sqmvo@revolver> <9eb93423-a2ee-4b9c-be8c-108915eb7e0f@bytedance.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <9eb93423-a2ee-4b9c-be8c-108915eb7e0f@bytedance.com> User-Agent: NeoMutt/20220429 X-ClientProxiedBy: YT3PR01CA0101.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:85::14) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|CH0PR10MB5259:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b225e23-2215-453a-13e9-08dbca6aba40 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rIAO5NPxaqfyvDfwLgtqhKATuTnUFie32bilITnZBjESseJLIvD6JEd5utUZrsG+OuNA8exDSQ1TSMcA/cQh/HM1uw38WwTuWkGK4JP0CvK7T843fnvn+8VqJyUMwvouiPM+V6mI7bOy8o4eehpugHDOA4S3kkHnKmLoehYdV/CsCLqvsO6oNSjg6TLRgyrNrP9aiCgc/1IHDAaywTTNROkhzVQbtWqHf5lwH0ttvqAuIA2puBlYc3wBp2mnb+8WXuNhRFeCx4F6PTvdq3Nh8M5jY8j1JTfKpha+JnTh+uCeAqE6x3JKvwE5z53X8URoyd0HIDNt3pOJaQICqhBrQVQy/Sj6mDYhH7LUeId/zzvmDb0Q2hkMKZ6z4dMSZZ20aD0i/3PYKZ9QkelvzuBYd0LUct/oB/PeZwbnoIjoCJPgrFmQbZYIav4LZpWM1uQrlCGabT8FgRMQGNPAbwLJAAsc55ldLEUHXrQpX8HWk0+NKSDBny38uFeKIBwQg7quRKsQ1ajny/MLHXM8zl22RkQtTp2UO4jcEfDWRSUJ160= 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)(396003)(376002)(136003)(39860400002)(366004)(346002)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(26005)(6916009)(66946007)(66556008)(66476007)(316002)(83380400001)(1076003)(5660300002)(478600001)(86362001)(6506007)(6666004)(8936002)(8676002)(4326008)(7416002)(6486002)(966005)(2906002)(38100700002)(9686003)(6512007)(33716001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?V0Y5ZWJuNGdueDhBMHByaU9wWHc3b2JKWERsNW5uaUxYdVRnQ2REZGY1eEJh?= =?utf-8?B?bUNpeWttZGpxOWN2OXhUcjFhVUZuMWQ4cXk4N1U5dWsvSURzWjVvNTE5ZG1J?= =?utf-8?B?OE9XRFdLa0JYY3dBSUFOOEZSNkpiMFlkUm1tMzV0Vkg4QXB0NDVXclAwTm8w?= =?utf-8?B?V1grWGNVSmRnOWRsendBazAvZGduMHQvVGpmdGgwSDlqeTFyT2ZVbzJHOFRU?= =?utf-8?B?QXVXTTZLdzB5NEJYK0hWOUtYcUZkS2RTY1VKa0dqZFhIaXhUNm5TcitMRWVR?= =?utf-8?B?ZU1ESWVJTDd4RUFvNG4ra3BhNDVhK2dXRHlqVnp1czZzVUhxWXZiREpuNXBw?= =?utf-8?B?d1RpblBSby84YnA0N3BISGhhSnRSdXppc2YrQXUzcEx1MVl2K21hQ0llQjVS?= =?utf-8?B?bUMvYmlibXFjUUJXcWtpVVN4WDJJMmxVd2hucVR6aDNTV052aGVRSnpyZDM0?= =?utf-8?B?WEszRmFmN2tvWlBoaldxemZ5RHNTWThYNmNYUUloeGJCRmJkalNnZGpXQWJu?= =?utf-8?B?dHduMklTTDRDczNsS0lOOVY3SldyWmQwOHRvUi81Y0F1TTRxc0RNd2I1WGJn?= =?utf-8?B?YnBYTTFtTUo1YWNET2pNNHQwOVRIL09IZWlNczlLV2EzNVNEbEduMVNxTStJ?= =?utf-8?B?TlFLVGdDTitKdTVEZjQ2djN3WXpSeVdUb1N3ZGUwVUd1ZmpzTXErY2pWNXZv?= =?utf-8?B?d1dOQkJFbEZJUmNwaThFYXFhamZkekpZdTRGRHc2NkJ1aW9JRVVldXVkY3h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R1dYM0lpWWdy?= =?utf-8?B?LzkxSW54ZlFZbllOaXBGRTYwU3o2dUNpNW8wb1RpRTRUL3pnd21jKzlkSDdu?= =?utf-8?B?aS82U2R4eFhRaFVTcUo4TjNOR0pOOG5TQzY0Q05qZjl6bmVoUnRQMzFRNkVq?= =?utf-8?B?N1lVUDBzQkt4NHdLZU9DdmxBcmcyV3lkaHZ3Y3g1bWQxcmc1MDRhOUlWWXlp?= =?utf-8?B?a010QU9QRGwwU3Z1WmRHOUltdlRJWUVNU2ZuYVJDbWE0TkFVRysvdXByV2w0?= =?utf-8?B?b0hnVTB2ZDQ1akVJbzlua1Roa3J3V0t0bG9wQzdxYWllOGdqbUxTd0NMS0Ew?= =?utf-8?Q?BPgdi6Skj2EC+8ryJ0xvi4Efc=3D?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b225e23-2215-453a-13e9-08dbca6aba40 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2023 14:59:54.4905 (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: M3102G0+7IrslwoVFbWI5k3cK+oLyy9ZGAo4O2wVfoIOjK0tLFc1hR+Uw8fcZfyCTgzIk01cp9htT8DWbF/ogg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5259 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-11_09,2023-10-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310110132 X-Proofpoint-GUID: uEthcw_PXY-sNNAxPhJNNHKgpSPsZ15a X-Proofpoint-ORIG-GUID: uEthcw_PXY-sNNAxPhJNNHKgpSPsZ15a X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 11 Oct 2023 08:01:10 -0700 (PDT) X-Spam-Level: ** * Peng Zhang [231011 03:00]: >=20 >=20 > =E5=9C=A8 2023/10/11 09:28, Liam R. Howlett =E5=86=99=E9=81=93: ... > >=20 > > > + unmap_region(mm, &vmi.mas, vma, NULL, NULL, 0, tree_end, tree_end, = true); > > > + > >=20 > > I really don't like having to modify unmap_region() and free_pgtables() > > for a rare error case. Looking into the issue, you are correct in the > > rounding that is happening in free_pgd_range() and this alignment to > > avoid "unnecessary work" is causing us issues. However, if we open cod= e > > it a lot like what exit_mmap() does, we can avoid changing these > > functions: > >=20 > > + lru_add_drain(); > > + tlb_gather_mmu(&tlb, mm); > > + update_hiwater_rss(mm); > > + unmap_vmas(&tlb, &vmi.mas, vma, 0, tree_end, tree_end, true); > > + vma_iter_set(&vmi, vma->vm_end); > > + free_pgtables(&tlb, &vmi.mas, vma, FIRST_USER_ADDRESS, vma_end-= >vm_start, > > + true); > > + free_pgd_range(&tlb, vma->vm_start, vma_end->vm_start, > > + FIRST_USER_ADDRESS, USER_PGTABLES_CEILING); > I think both approaches are valid. If you feel that this method is better= , > I can make the necessary changes accordingly. However, take a look at the > following code: >=20 > if (is_vm_hugetlb_page(vma)) { > hugetlb_free_pgd_range(tlb, addr, vma->vm_end, > floor, next ? next->vm_start : ceiling); > } >=20 > In free_pgtables(), there is also a possibility of using > hugetlb_free_pgd_range() to free the page tables. By adding an > additional call to free_pgd_range() instead of hugetlb_free_pgd_range(), > I'm not sure if it would cause any potential issues. Okay. It is safe for the general case, but I've no idea about powerpc and other variants. After looking at the ppc stuff, I don't think it's safe (for our sanity) to proceed with my plan. I think we go back to your v2 attempt at this and store XA_ZERO, then modify unmap_vmas(), free_pgtables(), and the (already done in v2) exit path loop. Then we just let the normal failure path be taken in exit_mmap(). Sorry for going back on this, but there's no tidy way to proceed. From your v2 [1]: + if (unlikely(mas_is_err(&vmi.mas))) { + retval =3D xa_err(vmi.mas.node); + mas_reset(&vmi.mas); + if (mas_find(&vmi.mas, ULONG_MAX)) + mas_store(&vmi.mas, XA_ZERO_ENTRY); + goto loop_out; + } You can do this instead: + if (unlikely(mas_is_err(&vmi.mas))) { + retval =3D xa_err(vmi.mas.node); + mas_set_range(&vim.mas, mntp->vm_start, mntp->vm_end -1); + mas_store(&vmi.mas, XA_ZERO_ENTRY); + goto loop_out; + } We'll have to be careful that the first VMA isn't XA_ZERO in the two functions as well, but I think it will be better than having 7 arguments to the free_pgtables() with the last two being the same for all but one case, and/or our own clean up for exit. Even with a wrapping function, this is too messy. [1]. https://lore.kernel.org/lkml/20230830125654.21257-7-zhangpeng.00@byted= ance.com/ Thanks, Liam