Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1088080lqp; Fri, 22 Mar 2024 05:29:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUj/NH2cjvuOCILxrRW5cchL1JDMVUqC2rgT7+W4KdIWtDdu58cL4/hTeJmRx5t8nz6y4WyMqpX/tmkDVZ/ptQMGxu5GgmrcpKiJjbyYQ== X-Google-Smtp-Source: AGHT+IGjuUhtSLZw9BFy5nl4HBj1t4mNiWqy003ogDhGyY38rwgnJL1Sr2dMUhVtN2/N2ZOd9Dvz X-Received: by 2002:a17:902:db06:b0:1e0:1bf6:1f89 with SMTP id m6-20020a170902db0600b001e01bf61f89mr3171560plx.0.1711110551405; Fri, 22 Mar 2024 05:29:11 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o4-20020a635a04000000b005e838a618besi2057998pgb.11.2024.03.22.05.29.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 05:29:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111418-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=MyQ4R56Z; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-111418-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111418-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E067F2872C7 for ; Fri, 22 Mar 2024 12:28:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 160D44087B; Fri, 22 Mar 2024 12:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="MyQ4R56Z" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2067.outbound.protection.outlook.com [40.107.92.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 561472D78A for ; Fri, 22 Mar 2024 12:28:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.67 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711110529; cv=fail; b=jTbwfoxLNCn9DZ1Rfxx1YF0J68OcZrgDcybBTUMYURbEv/vodNY8qbv3oTDVC8UDb2+6JkUgOVhJY7+MCxM9GYKQ88bF9ScwStDaP8KQgNfkOzgqpI/zFN19r2rUlV/H5TLvz7iZdIql/G4s89/XeUK3d2f7FsXceAw+QsEs/EI= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711110529; c=relaxed/simple; bh=nTTi/JoblLeMGy0E0zPpYCyb3iNkaat/pjmTxUS4QZM=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=bRwMpybLIn0eqZC8bnoTvkODXHutEFLX6CfDxdplt3Zm0crqJVwVntNjowHyv+lEZOcQESMvpHG0NeTLzfj/rWDXnLaM8mmfF97CinBFTX80NSHLMpcZgu9U7VBx2fXRP6Eaf7EQL/U+otzhCfr+//Il01Ye4RR4gSpsAnOTFog= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=MyQ4R56Z; arc=fail smtp.client-ip=40.107.92.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M/L5rXMlH8oiI2J6oqzgrh72r27VDeYnWVJ/EY1/V9YcdN9SpmMz450ZPeyrEAb0ut9f/VXiemYwMVj0SN2a8hFTEMYanSjLMoEP3Z3PQAD0VNLr0VZU1V+dxmGBNrkYAVecGro23nQauH7UpkTPylJ68D4A/Za8/3v3l3FTCnahyQJa20XYw7AlphylyTTUMJNdD+gp3oANDYd53X34SjB7WEWG7yvqixoa7Pb4bpplHro8lMNNYbRfIwgDVpqL5PBIvnVLB6r3wEl6OXmF/a628zUVHB/oQ+JcWXwGeHu/KA5IlY8Yu5DcsRZQNTNM9cNPhJ8EeP+wkvMSGSjrlg== 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=dDkdacFtxB4qpcWdtAhoFkR9iyBLJ80XO7PfYd0ZaZo=; b=OiafJN0oRHFiQp6rBeCaXROCqnmJoqkNuW5dnP1P/1x/2DDC0Yybg3W/vWdW5/MZ0hj0q/cKWwbVEcZyb/g8PIXelLA/fcpg24LX/4tccbea7UnUwECUmwPU0KL1zOUPNCNe3CZabJNy8YTLzdqVdJfO2e4KsVOlPsBaRIKhQYV3E5dhzORMHxeFYXAoMpRMUguysdjmNrHpAGr9ZXC5hMhc5hCWWJxLkUmrZC07qLT/B/pTmcVV7eKDc4DnPVSbwhhO8O07YCYOVGNYgjaHxtjCI5p4TOnDcoPCRU9L/n6U22tTON1MykY+sSdOLSDsqi30RGSZgv4Pk2CHxQV0cA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dDkdacFtxB4qpcWdtAhoFkR9iyBLJ80XO7PfYd0ZaZo=; b=MyQ4R56ZGrKp8VXSxsI9oyoz1f1pahvPhfNqJfFu6wV3wf5nbgynWTw58ce1ZMhv4Fjhtzfz4d5/9ijxUJ9+EyQgm+zFcnITBRoYsb+jWezbCE7IK6DCAzQ7s+lc5ennNdJPuc+LxQxeLB25seoSwoOdx/1tnatvTRHky+NMHvQ7WxfRGFEvDgMQ+KBzbdBONVhb008ghv8efwrTrqiHHEIy1RxnOWsx3KXraL1uVjDu26uofeLpIdcsztQIdGf8kxTuk/EY3SWxQ8Q3W61ij/8w41uQAaTvmGG575LBv4CBiphHS36mJ8O1kqf7U6lLlPUm8rDYOY+HA7MK6L6Tlg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) by SA0PR12MB4400.namprd12.prod.outlook.com (2603:10b6:806:95::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.24; Fri, 22 Mar 2024 12:28:43 +0000 Received: from DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::6aec:dbca:a593:a222]) by DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::6aec:dbca:a593:a222%5]) with mapi id 15.20.7386.030; Fri, 22 Mar 2024 12:28:43 +0000 Date: Fri, 22 Mar 2024 09:28:42 -0300 From: Jason Gunthorpe To: peterx@redhat.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Christophe Leroy , Matthew Wilcox , Rik van Riel , Lorenzo Stoakes , Axel Rasmussen , Yang Shi , John Hubbard , linux-arm-kernel@lists.infradead.org, "Kirill A . Shutemov" , Andrew Jones , Vlastimil Babka , Mike Rapoport , Andrew Morton , Muchun Song , Christoph Hellwig , linux-riscv@lists.infradead.org, James Houghton , David Hildenbrand , Andrea Arcangeli , "Aneesh Kumar K . V" , Mike Kravetz Subject: Re: [PATCH v3 05/12] mm/gup: Drop folio_fast_pin_allowed() in hugepd processing Message-ID: <20240322122842.GH159172@nvidia.com> References: <20240321220802.679544-1-peterx@redhat.com> <20240321220802.679544-6-peterx@redhat.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240321220802.679544-6-peterx@redhat.com> X-ClientProxiedBy: MN2PR08CA0022.namprd08.prod.outlook.com (2603:10b6:208:239::27) To DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB3849:EE_|SA0PR12MB4400:EE_ X-MS-Office365-Filtering-Correlation-Id: ab966d8d-c364-4bf1-e90a-08dc4a6b9d10 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CPnMZoVExzZHDb9OcxiBgGLYitj5FIIiqx32x4mh44DbnWWdt/methTG85EHxb44fo5BD0JaKFBeNACN1qaSgAIXeNNkTyfKlYyzLvf2JB/WSSWZkMdHUHGy1WbANI+tlgt+r1PLPVALYEKGkAD2TdhJ4Bc+lFw75s0GO/+NbAzbI3fDUbpKksfDCaiwdJzL2jA8H/tC1HT+56NMMLb7PjaqbETQsh8yv1XZqvkWw/F/xRe2YWh6W9dZBi8MLfzCGDOEnwfQZN627bveMQflRna9LXuHBZrr9UM8HPFzMbm2ZUrl25AvHSTFWFubzFrLlon1MeRm7gGmRXvMT8CWVfz6ejwtuCuVdxnc/6iitjnXuiaZi5T18J8XfcbkAeytJRnXoyPsaenBtFFspVvhKxAW+Rc5tThWe8z63TAFkRTeXTg1uO68Zxh3ejXMvFEtT5mySiC1NR1sq3sjhMjr1g4qeMRQuu+hY7Dim8DH3r7x1kmkRTQnN1xpbNyPoPmxTxfL7HP0xQEdpsfrIW+dx8BjH6edJOEPCVEO6pWOQUU4gvydVz6FxwrG9iqloL8xq5Q8xXOtGZDDvTYJvPKL+zLTPx1rUoXLpVPsdCPfOI6DJRp8QBuItK5eCZgChc4CglHOdqd7IzhI0s63EmKFTGTgishF9KZWjk3mU/fO+AA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(1800799015)(7416005)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?m26tBCNfyVStOXLVwAyNQSMBiqtU+WhZ98GDmtc0BbHhxLJbzdvQmQCpyOTd?= =?us-ascii?Q?JNe6WLDRpc1pL/Pwkh5R0KysulfEhdisK0BVtmm7d6hcN60HE+Q4wVLlQXec?= =?us-ascii?Q?R8ihPky77zKrrrCKBDxV6AjeyVvNOYW8i0rpG+95L69ius4oHf7pu3JbM8Lk?= =?us-ascii?Q?x9v9YWGwicJmWtPJvVBzz+PLM2oYdjyanl2A5wlyJXwy6KSxzGKUhSS3Dkp+?= =?us-ascii?Q?LxvuQdF0ER6RO2PB/BZEm5c74fmB52kHPH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RvAxZ6Ns92N5RsxoW9khetiIsbJIHHQQNZ/DQmbvsLQ?= =?us-ascii?Q?YP2xaeT921/n38Ry9aSYPj/S8wg4XKhH0hQAOkKg3BlYhTSBB03VDjf2miCt?= =?us-ascii?Q?hkRAG6yPTLfWbuwdBo3TjxOiBsucpXmGBT4GSd1nbpAbPnB020Kk1iloEKSf?= =?us-ascii?Q?8jGguAY6sd3h6ITwd8zUcg4PLvbEr8J/wCkzluOzAcuLLE6LI0vhtKsSHCU9?= =?us-ascii?Q?uImdGfYLftkbRThrLjaPh9D7KtApMsABlihQshBPDuO86hafW04qNVgD67q7?= =?us-ascii?Q?KrwxJn0thmP58jdxA7ovZBP4BdImNVc/oUOW1MiWuJZnK2N0xBUYVeEMZ+Bg?= =?us-ascii?Q?uD8DbY6PdZGf254mSknNBlqfc6LrYZNOGGUmRx7omZ1XswCVmvwqXMrPlZ1M?= =?us-ascii?Q?PzxOTasoBORY14Ze5xuAw8+RA43k6s1teabQ47EJ?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab966d8d-c364-4bf1-e90a-08dc4a6b9d10 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2024 12:28:43.8149 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kKi1xHvflu29M8CoyCbXQXk/zZYiQ+Ipa+Ydojw+kkLvhrMansU7jp1FjmJ8K8Kj X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4400 On Thu, Mar 21, 2024 at 06:07:55PM -0400, peterx@redhat.com wrote: > From: Peter Xu > > Hugepd format for GUP is only used in PowerPC with hugetlbfs. There are > some kernel usage of hugepd (can refer to hugepd_populate_kernel() for > PPC_8XX), however those pages are not candidates for GUP. > > Commit a6e79df92e4a ("mm/gup: disallow FOLL_LONGTERM GUP-fast writing to > file-backed mappings") added a check to fail gup-fast if there's potential > risk of violating GUP over writeback file systems. That should never apply > to hugepd. Considering that hugepd is an old format (and even > software-only), there's no plan to extend hugepd into other file typed > memories that is prone to the same issue. > > Drop that check, not only because it'll never be true for hugepd per any > known plan, but also it paves way for reusing the function outside > fast-gup. > > To make sure we'll still remember this issue just in case hugepd will be > extended to support non-hugetlbfs memories, add a rich comment above > gup_huge_pd(), explaining the issue with proper references. > > Cc: Christoph Hellwig > Cc: Lorenzo Stoakes > Cc: Michael Ellerman > Cc: linuxppc-dev@lists.ozlabs.org > Signed-off-by: Peter Xu > --- > mm/gup.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) Reviewed-by: Jason Gunthorpe Jason