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: 13911032 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 2BD75E77184 for ; Tue, 17 Dec 2024 05:15:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2CBE76B00A5; Tue, 17 Dec 2024 00:15:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 22A4A6B00A6; Tue, 17 Dec 2024 00:15:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 055626B00A7; Tue, 17 Dec 2024 00:15:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D5D506B00A5 for ; Tue, 17 Dec 2024 00:15:38 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 96443160481 for ; Tue, 17 Dec 2024 05:15:38 +0000 (UTC) X-FDA: 82903286214.17.942D487 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2043.outbound.protection.outlook.com [40.107.220.43]) by imf28.hostedemail.com (Postfix) with ESMTP id 556C3C0010 for ; Tue, 17 Dec 2024 05:15:02 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=MHihlebL; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf28.hostedemail.com: domain of apopple@nvidia.com designates 40.107.220.43 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734412502; 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=OyhHXaVFCP98wAJCXCHi7ZVmXU5gORdXGbcIAEpJcHI=; b=1cptwF7cM9wUA+EN43cKZ3h9NEJtjnJIoEHzt1SdmzECsl7LHK1a3IZCNip59L5mRGngqW e5NjtlSw3hYgHQ/1hlkiQtjG5jVP7Gt1sVTf6jgINcDGEyn/iNB34LG7KywmTXtnyHfclG nWDlzSTPGBOWCrS3JvZlSgksZAVAV6o= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1734412502; a=rsa-sha256; cv=pass; b=WruZltU2ItkM9s4vpWZQVUyVL1BTNqrz/N7j/Uv4XJ2QATbO4s63wcqvvby/+zDdjRHOE2 dLzguMd2BPlLyKzsOZ8iwRLcJF555YkrvrQJ/+FjlUCuWNLrfHQJirpKMTkU9iTxGFGuL2 f6nHe9m63MgKT68TOg+2QKvzCadWSME= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=MHihlebL; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf28.hostedemail.com: domain of apopple@nvidia.com designates 40.107.220.43 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com 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== 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+8dXTXkNYTTftV1cT39Mwe2RQDiXqsYqrZvY2BMkd24ETaZqgQ13cv5QwPPMvFNNsDU6JP1/jZuVYji2B/I2bqmfsKZNfRqjrko1jLj4CvqO/daL33KAQ1awLZpOGEDbVfB79hA8qBrszy8RmWcrkv4AR111x3CnSafGudTs3JifNnm9i1uT8Oq2bCJ7AGduAW2aH2zVfOVQ1vB7kA6nGKzyWeQbHn49Z+JxCD/qacvqzzlky7Bh3U+VsQJr5ywPxS4poC4iUtGJ3wpkfcn/I9Flest7pMbD3WbtPETRaZdTatj+xKlSFgTxwWxhuBbihngaDW6b35nfCCYduCP04Z+TSndCzqBzq8oPvKZ7z+7mFekmyZGOsXMgkAD6f1yGa9J6Bx7IPhNAHDhPEeEfkToBp6vAeZ2+rCBx916m+0Mo1IPa01NumK2z+eSNocLAlV6PSoWsogfyliCa5ufQ5YG/veMbVqkjMEZQ3E8ehr7VIq5umDFNCCPMlMnX+XVue6NDU5dc7ynhq8uAKV+C7LNVPs4x4ev9yf7irlx6QhKqHZGuHx4MIOwj7A7Z4keFP3jeMUMkDRn+WgFQ4iUi45qMtXb7A8aEJeUmNx3EbaY7rils0SNxUOMscmiX91oyDGrKNmLPWXDYgrGPQodb3ZIOkkKoGJkjjmbh/oFNWO4xapj5rNB/PlY9jfDSzw97ohFcUzcYfk4E0Jf4ENvK0Ry5uR0pQAa3psxS2ey3szC8Ze4DZmy1pgnhfoYLg83lYEjx6Rqgih+uq61/rowwNagHnaMG3D2j9rxXVIZ2fPbdtk2eMDTf6/dTAI9Pp5S8zYddUglb29GmvZ1HWRFoWdDjc2GFmTcEhIV6TsxXy3PAjSMHdjv6KBOe/RAaE5+Pfv+18A+/Ais9btzK01VhxG41W00LhCepj1wcUyQjYw68aGTDNglA4Zd56YV9wQIAzipIybFjfTg/qOBqwh/NrI8zleWylPNiact472FAhgKVwXyGsbYggU6ONF24tZKcu5C6OZ4IqjoqNkBiZBI6TaSpHaT92zyfcY9aQZhiAvJxHB7Qu4DnxIX1I7RCPR3nyysGxtnWI1cuVKljFBlaenNwVLrpCRHaUQ4sro/9yLCRKLkc/+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: MtlgIeiMDaEAOr7ppCQ4yx3J3oQdSLZ1eLYvcOnX9xuVPKzWXpWLgh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+QDolpGEjsRwfyxoDzHjS+R6+mTiYk74ps0LYdrEj85RNNQ68rdLWxfVLLptSojwV1SdWvytVgQr6QlT9JGQACX3vYSGmTNI4HoXYXPKycmdHK/Cpf6V00FlKgQhJi2TeqrzidUEKRdm+kyEOUYgnQlpt3NWsItK7v3ktNl7oUJvTF+43uHLjHEwBJJjsD0ULhUnAsJnSjj8N/l7XUzIdU5HL2Ljq+S+YYH/f4yJF0oLcpIFW7oHkZcd4DUCvJSSuvMcmFyQ5Aif0WHVrqjRxUyQr5XR+U+/fKVOTIiEkl+sQzdBhmL0xWQEM3JswOdtUIkvMOsx7kZ4uXNULMAu1/GofkfrSHJXDurKZxqObuYBtLdW8sfr1JpieTGbzJ6+qqC1yfV7HRrThUWuFN1N4AznsBwhC48trsWgmD6r7JqxXp/Ci8CAK/hWfRZ4v2XmYG9YxNJosfLojz8/2OdgSe8 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2d6589a-78c4-42e1-4680-08dd1e59c75e X-MS-Exchange-CrossTenant-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-Rspamd-Queue-Id: 556C3C0010 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: a91pj88t77kzt9gitn8dzkndzkh4bxw3 X-HE-Tag: 1734412502-229848 X-HE-Meta: U2Fsd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wvGoWmyKq7fJJhDqSKFa1X0z/iSw/b16q6I2DyKjLjThRQjPBdCfHljzHPF/U+XyRHZ7d30liVvlI0+kadSImh6aKGRTqDKg/3Oz2lB/bupPf9oPpNAhaXAtN/9O09aa7sAeKd2VMmLJst37NAEUkvCQqazSP41z2VZ2aFM6QbfQXdD7NTD4buRICHfiLSGOMYGVfYETItPgA85hYrRviT/Nh9412O2/IoEuzqGX43PD5kU2YmxSUIFIEo5kT246LG56c4XT7FP9+w6aloiQ8y+FUmmv3SZnZLqyN1WDgvn9QtHSmCwdtZo6PrFbpvLRjMDwpQ0ToArgS+cjFKT3efvGKPlffzHA2i+o+YIpefrv7ym/vJctX4= 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: List-Subscribe: List-Unsubscribe: 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);