From patchwork Fri Jan 10 06:00:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13933839 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CCF17E77188 for ; Fri, 10 Jan 2025 06:28:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ck5XiCzxtWS0Ep/kZkIuKJrjA1hdch3Ab631Ko01rm8=; b=z4Ayrr7y74aTbeQseXsBa3rNUt z7Sw7KGj1CT5UVXmGODdSxtPduGWYpclOSLMoTlhwiApQyQfCasGDWWtVxhSbiJETbYeVmf11FCMt 7vi+zIS4sz15dqY4pvX4MDHvvr45uo1a5tv7xZ2pvyH+UnVelO5h9AMwnGLByoQ2nsJMxU1HM7XIO l3SAy1f2xGr8Ip+Mg9t/VWK7oqW3nx7IL0t7BsWozBEUJ3gaMQCsMLuDZDlLSIP8SMNihJbMjJZOZ TEBwmTfk80MbOl2fvP285HFhTIkKVAJGM0w5yVPX/NkYh5oVv+A1oASVd4swXbwcoMLq11oWHZWgY QnyzlwKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tW8VW-0000000EFy0-3x7r; Fri, 10 Jan 2025 06:28:34 +0000 Received: from mail-dm6nam10on20604.outbound.protection.outlook.com ([2a01:111:f403:2413::604] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tW86j-0000000E9H2-2reH for linux-arm-kernel@lists.infradead.org; Fri, 10 Jan 2025 06:02:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mtAsPJnp+HCXR679ZPBUBHPv/N3PJsre/UJUdRFdQzWpM6ysrKfPJhHw4jno1fI8Pwjfz9Xa4hc1W0aJRzHF9Uj9a2p1/mSDRLaTZoYuyUSPDPZlaL0s6TNceiGnQ7qTkXnivtJc1heF9KZdl5wBJj93ZP4AgGKSK9IRqZtxTtrWIDL+PsLjdXQCVwSF8r1aN4fFjmEZOA6Mrv7xLR8WuGHe8dP0lgwrzjK5KpWjETnLl6BqwH4EvfqSa64atGE2N77pMk5Y98g4VVmfGxcZlsf8jie+Jrzmf4UhftDImY69afWnEfT3YsY21N/IAVAk/CeWl2iOojruRxVwD89jtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ck5XiCzxtWS0Ep/kZkIuKJrjA1hdch3Ab631Ko01rm8=; b=xOtChpO03iXrsXoob8PNMb3w4KlWQModaSS5StJ/CSE1EFL7tqWtMWGZgdvVFqj1esod0L7BbiteO5daGrnNAknRpnGTj9j8xqprpoJTRQk71qI23Kz5CnG2wh5kt3x9GDlVgdB4KimB7oeK2JFJfwujU7g8SSrrXVGbN+1gAbY3GaesB8Mhb3Zb86pxjQlkZRRsM7coPSYpvG3Nvzxd2P5EChcSx8Obrhdwn1pFcchA1Ofiki3FCVJfueMjgXpERh8l/OEMP57sgfCea5EpPJVOYnb68BbN/lwytNefve86lHCAGKhgubGU+M2qHKTtsiwcEb9RIoEbS5zmb1ZVTg== 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=ck5XiCzxtWS0Ep/kZkIuKJrjA1hdch3Ab631Ko01rm8=; b=SJGw/EBEOcZYMprz1iSTrsEhjKG8FoA9FT54gEjoU0Alrzq7pCaTGZz/xbzD6kRowI2LVCa9dvQvXPhLJmGWoVuhqFR0+jeiOgeTpP9Taa+efHq5b6d4Xdp2EyLtY/xVre2n2JAL23zsAzS6BQJFmh/M1yqGbaB61Trbii+TcYg76rKM7GykQTXjghsGLKOXqpjin3KH1lTfvkDJ5upyCEjxraJg5LI8YVwokvHURwVIDrMKsbr6TZuOiu/zs5WJKeFqJr9WsLK/Q7BOHwREqMZ+S050gSTL4yFRWeDsObKqAAAkfRhEphdK3TRMyQFvgfRMT709+HiTx07P6GFyZA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) by SA0PR12MB7002.namprd12.prod.outlook.com (2603:10b6:806:2c0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.13; Fri, 10 Jan 2025 06:02:54 +0000 Received: from DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe]) by DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe%7]) with mapi id 15.20.8335.011; Fri, 10 Jan 2025 06:02:54 +0000 From: Alistair Popple To: akpm@linux-foundation.org, dan.j.williams@intel.com, linux-mm@kvack.org Cc: alison.schofield@intel.com, Alistair Popple , lina@asahilina.net, zhang.lyra@gmail.com, gerald.schaefer@linux.ibm.com, vishal.l.verma@intel.com, dave.jiang@intel.com, logang@deltatee.com, bhelgaas@google.com, jack@suse.cz, jgg@ziepe.ca, catalin.marinas@arm.com, will@kernel.org, mpe@ellerman.id.au, npiggin@gmail.com, dave.hansen@linux.intel.com, ira.weiny@intel.com, willy@infradead.org, djwong@kernel.org, tytso@mit.edu, linmiaohe@huawei.com, david@redhat.com, peterx@redhat.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, jhubbard@nvidia.com, hch@lst.de, david@fromorbit.com, chenhuacai@kernel.org, kernel@xen0n.name, loongarch@lists.linux.dev Subject: [PATCH v6 18/26] mm/gup: Don't allow FOLL_LONGTERM pinning of FS DAX pages Date: Fri, 10 Jan 2025 17:00:46 +1100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-ClientProxiedBy: SYBPR01CA0211.ausprd01.prod.outlook.com (2603:10c6:10:16::31) To DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR12MB7726:EE_|SA0PR12MB7002:EE_ X-MS-Office365-Filtering-Correlation-Id: dd00cf1d-6e88-421c-eb57-08dd313c6c4d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014; X-Microsoft-Antispam-Message-Info: BDsuwkPzSFJKaLfze6iKtoCJVN7RVzmGBxGy/5eDiJHwEsdD9R4tI7N2qGzP554J0/h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H7W5FjXZzDAYEeiE5vxbe4SMT4nwNlwflgFHpThsibRsbcf7F2H3dDmmDgep/4i3KRXRztp1SPMcf7icshRFIiuYBOxTRwVlKJ12AyYXcgq95kYCSBfWukyNQHSCbFcmvEgvWO2DhGUei8Q6CQQxQtlKQDFaB9YQ9OYZ3Y6vwyJjMT3R1n6kHAUY0E/4Q1eWQwpRNeus5C8hAH6YAXL8F5joMWEA6dU9HEasM7OyW7cVCHGmFITfsgl4MB2LSZD3iC2OWkT/SWLc501 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR12MB7726.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(7416014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oHEggWRc5RlMpeIzlu3ApBC0vdfeWQWYc6F+CCPS9q200xcMzqHKVwabeXjT8z13w0evTJeqd+wIqPB7927/HcD8LXpJHvMBeud26oZ9/Ws+jrPNVrzM6XSxZWWzYg3KPXBuuckdWBJ7Ro9W9M/9jEGeW4eP0Y4kAOFQ72ComFDrP3n1a7PKqx+7kU10QaBDcvL/0xTCdRLFiFCIpDk4EuNqgQfbuaHlvJNhRkWaFZldjCgN2/s9XTJfh2lZ3eL8D/FYB8Wb3LclQPuGsNL9n0RQjlM6pBBHOG+cVU4SPzGvdweoV9Y/PiWN7rU/TuDnNbhb0uGd81wfMJXzNiPwUTx5n5afxBJir94SLRneiprZ4ORoliKgN9fZaLjSBx21XmhU+66EzGaKQz8GfjeLmaz1ocoLRnlyxHvT6Xp1HLw2PF3XQyQ1HZRIEF4rOfINvNc0M4FuTysrdesFew66UBx3wuaOFIoXOX1qmJEVU0p6LIaCV8/prUHeglsvwUtviaFbVATCzSvXlrHbNF+ANtZsf0XA/yFEVSCHl9L50KsqXaBjG7bvJb2VL0xNeVVFLYCQQ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57-08dd313c6c4d X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB7726.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2025 06:02:54.2285 (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: F0hMsAucFkEFhYHPfA4mA+U01Tw+0VgCfuw5vRg8JTrsoAkhmPbUgeCYVx06XinAOhnBJtrgb1AXNh4FC0mhrA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7002 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250109_220257_726336_C3410339 X-CRM114-Status: UNSURE ( 9.24 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Longterm pinning of FS DAX pages should already be disallowed by various pXX_devmap checks. However a future change will cause these checks to be invalid for FS DAX pages so make folio_is_longterm_pinnable() return false for FS DAX pages. Signed-off-by: Alistair Popple Reviewed-by: John Hubbard Acked-by: David Hildenbrand --- include/linux/mm.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index f267b06..01edca9 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2078,6 +2078,10 @@ static inline bool folio_is_longterm_pinnable(struct folio *folio) if (folio_is_device_coherent(folio)) return false; + /* DAX must also always allow eviction. */ + if (folio_is_fsdax(folio)) + return false; + /* Otherwise, non-movable zone folios can be pinned. */ return !folio_is_zone_movable(folio);