From patchwork Tue Dec 17 05:13:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13911148 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 9AE46E7716A for ; Tue, 17 Dec 2024 05:34:31 +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=OyhHXaVFCP98wAJCXCHi7ZVmXU5gORdXGbcIAEpJcHI=; b=AKIOitX0GTB+PvSxmv+WN5r1eZ GmGqEyqijzEzExxd2dOZ6pisVipAeU1fJwhK9FjKYAhNqTfrJ4RJwghYS93mXlTOwYl8XFFZlTqx2 s+RU+esKDn9P8tGREqLSOv7CQeSLMv8EcIrXrpeH1T7sdnMT5sFS7B9SxOWu5WSHlUqBwr+xzQXgH ywbg1blAMjN+dlVtqKkO/R3eZ4D0BfPxzmeGAN3Jtj+8LPay0T+gHo8oLPQLfi39P12MuhXl9Keqv 9rj3Rs1russQ6fBvuZCjB/itVWOszEhaDDUp9/d4gwNzczv37EqUqsRFZnQJp6pw/fVEU9AXlFgC7 AKlCQz4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNQDu-0000000CJ0M-0m2p; Tue, 17 Dec 2024 05:34:22 +0000 Received: from mail-dm6nam11on20602.outbound.protection.outlook.com ([2a01:111:f403:2415::602] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tNPvN-0000000CDjD-1aSt for linux-arm-kernel@lists.infradead.org; Tue, 17 Dec 2024 05:15:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=keYKQM1d8I01eCGn8b5Jq1kQiJQH051JIKH20Rbrtw+hBVbCKrHXlwm/PsI4QfDsNrdgG6+KrqoUuIHGM+qruX74Tm/Twv8J/nIc/beCoDLEKhTYtBp37ZeckLDxOD5HQ1cMsPMRx/WDWUWCsKv4U2apmdm7XsSXbziEH0PHdg7KBBNJE3qC0OfNsNg1LGpM3EU0epyd4LF+gTiiuw3a+bnkD40PfB+kr+bcLa0EM7Xzah3HI2/fJ2deiy30vbmes1jOGROdCBaImGqC2s2R28bFm8NBk9eqPE+RbjRwMVVJ4SXNRSFCrGzhP1GJsQTsnWgjuQmJzMl/juxxThp5Eg== 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=OyhHXaVFCP98wAJCXCHi7ZVmXU5gORdXGbcIAEpJcHI=; b=sRyWpMreKNYNd3njWAf+ZG97qJXj8+d5CwZke+YAVQqDhyN8OtdG/uhTX3AFy/q3rq6Cp7CtuXp82nVft4KqWBB5PNT0bfWxtDUKf03H2aqbHvx9eZdJHy2FpGmSgyqeJbWYACuuDfb37+HZDo444pNYpBuJgq4bLMHhDVZnVa5QFyIIIutPhxjPWRqLoKQWk6s7hp4TICiF21uuUxoWyYg9c/k1o4wDetZGy5jsY10zFFerlngFE7UtTWlBF9e0zjNC1O+14LoCBZ8WE/Q26VcnjuRS1QU9djLNX1YFL2SWK13E9Df+xTTfGTzG7jXW6tdLr0uXTTh5gd+h3UIWNg== 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=OyhHXaVFCP98wAJCXCHi7ZVmXU5gORdXGbcIAEpJcHI=; b=MHihlebLY9uab34eD+S2QlJWe4kJWsoK/OLgkt8GApBtnuTx+vESwtVNyAga4U6ZsKdEiiytv6A+a9UV9DRbhon7ZB/5fuxkBXHyDFVEe66TIxNnR9Ly0S/llR9t8CoY0/iJS5znqr8DKs0S8Ajr6Gvoc7zPUErWq0LcDXZeLE5E09gQ+9DM+0ZZKuxbA333QA29SnZc7Jk2lltlwMDvV3AO9tylgY9dpsKX0eyT9oFTLb81auzuxH3pBUq7uQGhOu4JN+6sVKV7QctM1KDBEnBrlr8Urk0/eyYYxvc9VhKAotcT/s7mcxCg6WVNOd+19Xt1I3SxKptE6xDOlml/gg== 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 CH3PR12MB8936.namprd12.prod.outlook.com (2603:10b6:610:179::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.22; Tue, 17 Dec 2024 05:15:10 +0000 Received: from DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe]) by DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe%4]) with mapi id 15.20.8251.015; Tue, 17 Dec 2024 05:15:10 +0000 From: Alistair Popple To: akpm@linux-foundation.org, dan.j.williams@intel.com, linux-mm@kvack.org Cc: 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 Subject: [PATCH v4 18/25] gup: Don't allow FOLL_LONGTERM pinning of FS DAX pages Date: Tue, 17 Dec 2024 16:13:01 +1100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-ClientProxiedBy: SY6PR01CA0137.ausprd01.prod.outlook.com (2603:10c6:10:1b9::22) To DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR12MB7726:EE_|CH3PR12MB8936:EE_ X-MS-Office365-Filtering-Correlation-Id: d2d6589a-78c4-42e1-4680-08dd1e59c75e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|7416014|366016; X-Microsoft-Antispam-Message-Info: FXjBHr6Bg4Wi9Wn8IDtv4IUCDW6mQGnFmn3tS86Ro+Q3jX9paW7uU+8dXTXkNYTTftV1cT39Mwe2RQDiXqsYqrZvY2BMkd24ETaZqgQ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yLCRKLkc/+0n+Z0IqVN+fGYmSiG1tiKek+FNb3CgsuGXmomL2L2C5hMDO6JArmH1ElcgjMYnjW4iYsZQ7K1gKW/OluX7SZ7eTqIarLXSAN/D+DczxFtdgPldaAPEV2gjTZFM5bYpqsIhhOr0H+jOqNJVe+6U9kzA/ZtxSmHX2+7FBgdC+r2WQ8vkSOQ9Nfp66gAcnJqi7Q0SpbVInJgxLLe15VvFYDmu4J4 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)(376014)(1800799024)(7416014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MtlgIeiMDaEAOr7ppCQ4yx3J3oQdSLZ1eLYvcOnX9xuVPKzWXpWLghzFzTNs4LoWWloZXdlM4lPRutC4AcsEdkpq9LU6X89diScnYdTYTyQRjvmBsip4uL+wSeXhSAXa+KGaJG/ToAH1Ud1H9wcuBQh5Lh7S9SG8U3KN7s00Wg7HhSQQKgDs7gW0lPb9b8QaSUZ7paoU7qdsDlzERd+Jhxxo0xs6oPfjFmuQmE719jJ7JQF9Xu7X8a84cEe8zucrqzE5uRqEInqeN/U6erC6b+I9KK4YDFCPubpWEfKicUTkUWz5dDcFXmXZV1OCTbNEKASPss2lmlAxBKw5/+c6RZ03gH5hOYsfZDF2tWwInv7IOdhytl4Jdt+/KvHhNpHJHrTgIhn5ueLgpe3yCLIMsvrnxoW4vyl5iBSCE6fWdi0964OuCd9QoFI9bKLsPOVmJS/6MR/82YsiL0mptB1iG884WYcSNmq7HeNqndfZiuE0GmZnnTcXjZLt++7XlZesg9TAKLwX3ny6EMd5edeXiL+PPGEBrbeHAkPr2k6Kv0ab7dTMPuMzYNURhTyTVNIiV9ult+u5osCddteozyOBNBPuNJW0u242K9FJZguiMegjQbF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rossTenant-AuthSource: DS0PR12MB7726.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2024 05:15:10.3453 (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: mNg9rKRHSGT4IA+kpvRtLrAqFoyZG2rSAlG3LyVqri4S+ZzzJqvLi1ONfTwmUVRxcwa7gLtieWFKNx3mpGRMIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8936 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241216_211513_418553_3A8D4163 X-CRM114-Status: UNSURE ( 8.28 ) 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);