From patchwork Tue Dec 17 05:12:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13910980 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 E35ECE7717F for ; Tue, 17 Dec 2024 05:13:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5AC5A6B0083; Tue, 17 Dec 2024 00:13:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 55AF46B0085; Tue, 17 Dec 2024 00:13:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D4BC6B0088; Tue, 17 Dec 2024 00:13:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 1D2C96B0083 for ; Tue, 17 Dec 2024 00:13:47 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 9CFAF428F7 for ; Tue, 17 Dec 2024 05:13:46 +0000 (UTC) X-FDA: 82903282434.27.8321D15 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2070.outbound.protection.outlook.com [40.107.220.70]) by imf03.hostedemail.com (Postfix) with ESMTP id 2911C20007 for ; Tue, 17 Dec 2024 05:13:29 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=LoVTDEQM; spf=pass (imf03.hostedemail.com: domain of apopple@nvidia.com designates 40.107.220.70 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734412403; 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=p54xDpSMcpfpFU3zdQGXgiKs6ViJz/NPgxrzUcuVzcQ=; b=xzooSzPTcSAha04sgeka3O3AGWYqDlIvETFzZlc1vdvhlHBuCeVM7Sie6FUeSza/ArfGR8 7dhvhFXQP4eHhkFULatRZ4SiFKKZ3NapUM3to9Nd2EPxBtIaYHQiPhN2aMgUB8PNR5HeSL pArUG8C7VKeCNNxC09ivrhsHvA6pNWw= ARC-Authentication-Results: i=2; imf03.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=LoVTDEQM; spf=pass (imf03.hostedemail.com: domain of apopple@nvidia.com designates 40.107.220.70 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1734412403; a=rsa-sha256; cv=pass; b=LFHdWogyP/Hg+AYT6YUdUTPGkNpsKzCjVFZeB1x8RK78IPttVbw5b3rUboog9Ggo/trjMQ lL4LMbUlx6CmIoBBFcVKgHrv8tU+NoztYA5jijnMdZyYwlQsgnMvz6ChPnjWrE04lI2gXz agItJuzTIB3o1c2cmf19uszbAuInpTU= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tcg2i+e00bYOzf5+IMcO78OWxy64HQ39Jw2NgXVVDJdsAi5b9b/BerM+l11YPAqsj02R/UolQ9RHUpun6Uf48SVAgjcZ0wwcqZmwTfFJw8LZfw/4XpilAXUiAXQWdJ38FSJ/M6+pjv+mYYAT0Mnfn5ompsiwy46fXA6JZt5nCBkz9oWHEaZ34s9tNiF/NP+L3Dioj6KQ0mzMUI/91W6veQvlq3OIOuW7WcuZo0aLEcBMJW9u+THPyNzZE1Ocnd9G5i4f8poOk9r8Bpr+Xx0sHmL5FqTTLGhEKel8IKTwCJydq9LLJtOmdVY+Cj++C6UEkdAfpF9/HtRXrIucieMh7Q== 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=p54xDpSMcpfpFU3zdQGXgiKs6ViJz/NPgxrzUcuVzcQ=; b=RTe16Xbw/w1UCRWgUVgU6CEqfSleItxgAX5HlbMT71D1CoBKeNOU+ZAv2fXEuxVlZjMhqfysI/MCtglp3fOezrJHGJmxdsk7CojHMte5a8zpxLVmBnt4AveegSIbavxJ74NzvOz6ftaCtbZcbKhIBpoihVUGJZj8f7TajJXCj6tBFYWbwPQZicEzppJpGoKckuUIdr4arsfMBEmVgsOw8gk7jw/q2rsW40HYJQqdJqKYuErsuK+q/WhVFng6pWFDEVIhBPkl2x/XRQuBQmYplPICUj+SffCqJ6ReFvaxXcO9qerqrl/kZJn0S/eTEVwqBJZbLl2wDhL3M0/sKAFGHQ== 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=p54xDpSMcpfpFU3zdQGXgiKs6ViJz/NPgxrzUcuVzcQ=; b=LoVTDEQM9eybDYK2AQds4kBLSUrZ/8tGKbzsrSiMXR3iIJ9mqTN+tCc7tKqTUmY8RCX6l3SGuhp28ea9na47487rqlk8HiYpTeIqBHrcotbHC5BAJPs2yBH9mo7xxPJQKpzpLzqIfud1Vsihkd6kQObSSdgf/8drpOrY+ePzHUbUGl78JUQeXxErf4IN/HRnfWEW5SCN3JRiB5O+0gQfqjVKQUnWULBh3OpUJhodk8yKp1GOVgtGJGSY60qwrSS+aU+Pp7QN96Au8JOo0Xiso4ZqBuOyXf8Lqp0SXlrh1JQ4oHN719ekfQO/Hxxf9EDtTFqlgvacJ8U6HXLhUbyY5A== 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:13:38 +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:13:38 +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 02/25] fs/dax: Return unmapped busy pages from dax_layout_busy_page_range() Date: Tue, 17 Dec 2024 16:12:45 +1100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-ClientProxiedBy: SY5P282CA0196.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:249::7) 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: 7862fcd4-a3e5-443c-2e8a-08dd1e599060 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: aVPbxQ6cT4j+ltfPSRn84YCi7/9hdgCkH+rfP1j+Yv9+TospcrbdNaWkFCnp4A3hdsGgEpE9Z7IOaSUacKpb+nv4Ps1w2tG5XuDl3ansDRajGqwobRuHWkSKuDFxSyZwI8dbFTsCkIyAXyfGYQowD+9p7wogwR3f7SCTAbwMb6epz0xDXP7IHjm6d2IobhRjdOxM8QfPOD7r2Dp+g+DIKlTmFU/TFPpScLWQhgbu7oy42vQH3K/CWEVB8bOVLnDYDGprRPJPT5prGvA8DCSWvGN3qlqxrSnwQNWxW4GLnvHXiFm21DDcQNVwdv1/xg0aJYFkrwznXGw3C1lDNNnMIyL4S/O6Yn5Vg7EatFSI9OYOQ0C53VmvDe0PyAb2F8r/r8npvOBXNnJYN47g56IXOK+cxUGyvk9PXrzqbI9CNM2Mm+8oexrpW6rrQMvdEfjtxeZjRg8grZN667H83fnXtb6VNLdPeV4q+acPQnb09qdTY+UABGAtFXL25L5SAcyAx6NdpYrsuNUe3sqL+rJJurh9f6U2HlGzDe7ibZlRALKlHO4YwMAn2Tmv3Ak9IkyQM63zgKpNDE0dVowLGXhkV2uO0Zmqo6DMIebUp37iRsIL1MjjZWsftXDurEow+6NZK5wOU4Q9r5S++iNSmgR/LZjzitkYZqmCtc7FGVwoHIcrWoIy/UqOQqBL2Fm7QGkPctC7S9G7HJeNsZH7jq8sfBqWjihS+UTdw5s2VW64TxJ4/WxdRUD18BrMy/OGJV381gGqHoA7Ygm+WJ8hEEGItJ/C2OggH/LhmylI+WLc9yIy5UE6C00MxN6zXRm8vvW36rSm8JHCxM0Ddl0BTxVng7RtCAAzGHIg+PsRxB9eaQBSWybC2/4lajfQvI/rLeP9l/QNdAuzBojSZo4N67LexOzvgLR8u9vboaWsCv5/AIFbU1CrI9VfxHYXArDvGY7ifvi/eNQ824ZUsC8i/mjr1W5tdHzoDumJ+OYFs0/jc7lM5T2nFSZKNzqWUsTqzYToVCWoUhxQFUkxek+5npuF/lsE3R+CEcDkaWpiG2uKmrQZPvFKAC2Dh22GGFNe1R/voYcMMC6M5UJ31jiWipIdcJ2O22XAojJYIqFGN+zv1EE77ooCGieziTjwpSxnkcsB0F+EP5quhc7ir2DUnC8rzSHs8Amzm62tBWskBPxJBULEYnAjNsGPRBwd3dpPVQBuUkk0fTsoAp1qkRqjaziS/d2u5Fhj28wp0w3fBpFd6piYw2X2io1PcJMSmAV03yUYppGMoWyCmVuSLUgysXU/KABcoPPe3cMR7c/YVRdtvefG+UYYEP5C8eebbVWcs8ukWY9RDIOpeERHO8kdnBoeUhNiRapgHlO2DFS3ixzpH6R3BdJJd+xWRMPmDdAbt4cG 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: FD5kxlqaIxXalhWVdsZq4F7a1UpfTBUfb+Ot+XCasBJrRkwP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MLj12LGVhAV3qMvjRSJSh9NKZduK0VPgESwSsNmu+liqEgL9l9YMnMmohEods6mH+FoJgCim06OSsQmm0Y4b4vzZxHzQxOg6i1mICtU/3WwF+drA27ROyb3D1/yjeL9U3KRfD8FLxFZsAcIM81Rb7w67RijsJAGUqtI+2GTdmwGPS309PnkGJkp9uD/NxMx76WsDip4i1Z3ukxKJ4D04kjzu1ATHZHVLxFVZn7aoTK/vRYXRtIqh7HU22aypeMm3YOVMMgL+7IZOe5LVlpcQA0El65J6WxwpVrnr20li3/+DRrylZNzjZ4MqNHNsbVoWM6ixZsmotHHXBBnJVdcb28EEqYOgxVppKx1GXBsL/E5MHwBHHperdI+5JCpKSfMxKdPhrb2fT5j+eA+1QtGS9wrlsO94h0qY/RRS2g6ClwMDAUiqlZoJ3GsQgZofgH4P76T6R0G4a2KewJX X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7862fcd4-a3e5-443c-2e8a-08dd1e599060 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:13:38.0920 (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: z+kYBsnWK315EWbxlelVxXP7jNn40OYVw7XJ2MUYKc2+7t97n6G0UG0Yr7ozr7q4zp301wgtJKbGwu/6FS1vag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8936 X-Rspamd-Server: rspam05 X-Stat-Signature: urzm1dpe5kwhikpinjo6ekgxd3oxppt9 X-Rspamd-Queue-Id: 2911C20007 X-Rspam-User: X-HE-Tag: 1734412409-464644 X-HE-Meta: U2FsdGVkX19yfLn+wzLC/uRuCNNJvREP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14gWn23oFsyCkky2sztp9kiL/IkafI6btay7f+wxXuUnwnAFIyu3AAszx30TAIwp3V8GM1cTMpX+j99lKvVJ9Dqj0l3OuufPrxRUmSKp/01cApmY8ml2cspf+MfEXbyBAWrQ0VkvgiYF3Y5eFN1vRht3z2OcBta5HXaCEsuTyotw5IkETuhJYKya/D0LkyztLAxFt4Sh7OR2M9cv/JJ4PPqVQi5fB/nJCiVRCvYEc2MdLe7NK7wR62H+tHp7vQBiVeZMDSg+HqKNjdt1ZHfM8aLD1KDZRC/v6fHRMka2LIb1abztqef9CsfUa5AiISbwE3BoThcQjDp819RjyJIyod+cldV/tReT1PQ/ZRjtbtsGOkRxVn2sbZvMNhAINMqc= 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: dax_layout_busy_page_range() is used by file systems to scan the DAX page-cache to unmap mapping pages from user-space and to determine if any pages in the given range are busy, either due to ongoing DMA or other get_user_pages() usage. Currently it checks to see the file mapping is mapped into user-space with mapping_mapped() and returns early if not, skipping the check for DMA busy pages. This is wrong as pages may still be undergoing DMA access even if they have subsequently been unmapped from user-space. Fix this by dropping the check for mapping_mapped(). Signed-off-by: Alistair Popple Suggested-by: Dan Williams --- fs/dax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/dax.c b/fs/dax.c index 21b4740..5133568 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -690,7 +690,7 @@ struct page *dax_layout_busy_page_range(struct address_space *mapping, if (IS_ENABLED(CONFIG_FS_DAX_LIMITED)) return NULL; - if (!dax_mapping(mapping) || !mapping_mapped(mapping)) + if (!dax_mapping(mapping)) return NULL; /* If end == LLONG_MAX, all pages from start to till end of file */