From patchwork Fri Jan 10 06:00:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13933687 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 66D89E77188 for ; Fri, 10 Jan 2025 06:01:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80F956B0085; Fri, 10 Jan 2025 01:01:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7BFFB6B0088; Fri, 10 Jan 2025 01:01:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5EB716B008A; Fri, 10 Jan 2025 01:01:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id DF1AC6B0085 for ; Fri, 10 Jan 2025 01:01:33 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A55DE1407BD for ; Fri, 10 Jan 2025 06:01:32 +0000 (UTC) X-FDA: 82990495224.21.3AA517C Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2050.outbound.protection.outlook.com [40.107.236.50]) by imf12.hostedemail.com (Postfix) with ESMTP id E3AF040008 for ; Fri, 10 Jan 2025 06:01:29 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=JQXERpPA; spf=pass (imf12.hostedemail.com: domain of apopple@nvidia.com designates 40.107.236.50 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=1736488890; 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=xy8qh7i3mZHDo6zytroBAIKc7I21BKCOmZX9uuIf+jc=; b=4rb7F2/ZXWjdk57Azha02dEhB39dJbDU3jGfcmkZGfKA8w7gM1Tqx+HU5AVyJ0LU0OMLv8 U7FYIkWx2r53KwzyyUo75MZ3RXliG1IkOshCc6jvHb5vA7770mIn8QsVSBBER/63djfjHT QUC2DNQ8dQ0I/b2XmmhYxFrClo6awAM= ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=JQXERpPA; spf=pass (imf12.hostedemail.com: domain of apopple@nvidia.com designates 40.107.236.50 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=1736488890; a=rsa-sha256; cv=pass; b=aV38ZbQCVzWjUl+m5pOoFtvPteFccV82cjtVDHwF2IsUTPiaQ90PEztCRMVQ79X3DprgpJ YfjpPqfR5QoksBO7cpKb0HGpS5PknQFPVmVga63qTJiA+NRqOMkmdoh9asxrPFW0qZkgaR EWB+RLkKEn0PF24uAk/NacqUZhkI8pw= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ThqA6vPA6B6yab0m/OQmJY1GQTRWuDvu40566Gun3+pVOLLp16PMdpot1sN2vBgUV+qvYCpil7jNk5/rnZHdDP3MVPRznaJvRl88KA4hRHDzbqAVgX6/OZhBxKIHmrcGC58F5lM+1WT/fb9Tmk/GUg2+2GpuN6yID3nqfHcith8lg1CJOX10wUPj6RXwoZiQxlJYLkntQt4k8H0OnNn6ZESHknLR4e6iKO10Sbv9ibA3m52XLuPhJrSDpcIPQReFD3/l1nynZWyIqaEq9jfas35Sl/cDYr4iMLgE4apbFehd07GnMphDFeOnnjmP9SAE1z97wTloHPCqO2VTXbWyVQ== 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=xy8qh7i3mZHDo6zytroBAIKc7I21BKCOmZX9uuIf+jc=; b=aOxwuuEB8vqlEiZM8EVK/+s43sZL1JD8wLMCjPzcMqPgMVqtn+qFAEQj2gQOGEZjqCj5dBej4xCM2lUARGiwL5rRtK0rL2cfXgYNr7TJcZKW64lq6vqiyTHINdupY7HjLqcEsZRB1U1Jh59TaFC/ARF/fqFyEM32H7Uu5ERj5TaoMcUqokIiPZyghalsJo1Cbl67dS8Bpgqkt7QmmlqNgGqeDiAdc+cxx6V8dhJWTXujNgU+dXTqTUEk5zz7vi5hPNGLQmPZxRr/9AliUUJiQ819zz16on0N4uGATpZFxb7MvJwXsc9yC6W9hvww2PjjkByT07qVGhxI5sN3lRzp1w== 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=xy8qh7i3mZHDo6zytroBAIKc7I21BKCOmZX9uuIf+jc=; b=JQXERpPAXK4ChSltsGHf6j2c3YwENDXtk6KvvJPMgb+Cy4zGeOToiNb9FTlbNQHXDamLuSDv2Kb1dqe7ridyb/niWMmatS7I5g9a5gFE1culM1AxbXNJm4uIxzpmbtvEjyIMBdXORAH1Y30RzBSmoxXcY5JC068V3G4caQT85ULCyb7fpEyAHDj5R6W97XurLBrI/cTgsDNcrz8PQYWkNejwB0x1oUVark1VIbGGabiu6mCRTK2p3X5tpzObvctGDUoLKjUmL2apy9L5Am63Svj3jwxgtBgRyd9DcwnNMvuiEkbkSYiHA6igh2P4GzMDtILOI042coPNjExLpOqOTA== Received: from DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) by BY5PR12MB4132.namprd12.prod.outlook.com (2603:10b6:a03:209::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.10; Fri, 10 Jan 2025 06:01:27 +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:01:27 +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 02/26] fs/dax: Return unmapped busy pages from dax_layout_busy_page_range() Date: Fri, 10 Jan 2025 17:00:30 +1100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-ClientProxiedBy: SYCPR01CA0034.ausprd01.prod.outlook.com (2603:10c6:10:e::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_|BY5PR12MB4132:EE_ X-MS-Office365-Filtering-Correlation-Id: b730bb22-f970-4dea-bba5-08dd313c38c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|366016; X-Microsoft-Antispam-Message-Info: 99ptmx6MPnO+tYG0kMqoHjaBMczHQPL0r4N48qSlfiK/aedflf3Gqbsix0WPS5IPB55kq9H88a3gwix/vBX1Q58XUUCFVkVYOC8vb0GIDZr++sRfoBqhE8lPUSW5U+Cmb8AJ7OFwRGVFp4LH3Atd3fb0jDVOuYMiqlhebI9cjCvl1TCDgIKIpUmza0i/uPmyZYycykHj9NmZHuBMGMsZv5DveIMAW5Oi14A/G0aBlpTrV3tMosVQOuVpo7kaEu7hUavHngydxn8bZusXAqJ3Llvg16Jfc8B5Thk/gpLmt4uXeNbr3CriuVa9FQlEwwiHd0Rd3Oj3LnS4fVVNwtuvwKUMYnWF24VJchPvbZ2ni463gf3hAu7lJgMeB9iNbb0hBQAMOddQH8tIGKO7y2GFKj3O8TVsIapj6Z1d+AHI40ONkZ5hERUc3QIOWwceQ0CwCezACmZL4Gy+H7SbB5O0uehwxyzTzEANP+YLJWxhAmcwvxq6UZMD40npsm7q5KzdA1senMMjKJFUT1+/Tt1Ph6fjS3Ba9PbUnWlFvk7rkvDCqDNmAUiS53FMi1PGBySfzrQiY9zgmYWn/NQF2z3kENDUjOLcKBdtbszooJDDfM7lFShykU4cxNHNFP7R2PVGGqwiYTzTHc4mCQ5esd37FKVgulVl96wREAO5IlLz34fL03TAhmvX0whMhfKnJjzrm0AMcNv+rkR9rxAycYq+eYnmzWQDR7sVlwyLntG7UUgebNE2FsOUK3vE4KILlG6BcWFUXxSxZtYH0tnOk8yhFYZVTJsKDsAFXxeLcfZyaa2PCsHiEG8M6nwJDCNehI3JNSMxYwzkRWL/GOyySKfw7hbiZldejp3vifU82yUIK8NHf4Qo/lz8xaOEmYF+ZpfOJn/nlt50Apz0vbiASogX7jt6A7KhtM2l1/o2UbcA0GHFb0TaJLNPDTzufLObRdRjPuEK7mhJliHkb/DCTL9TYd59U6UY+6EO8FQg32qivbuR+RGRuiNBfsxAnLQJTk0CM9HVHzeem9uErc+mKn1gNah09lk0yMctpEBuGiaQzVVtmASuj7H8PbA6ZmvzWrCdqvwC3LY2QIQJPtaPCAOy8U8H0CvulDNBSh0D7QtW4uQucx0RPHTRSmRWelqgRFbEnbFwQhN4s6HnvqquxqdlxA17krOQUltpZyl38U8WwoL56FFCrYTsGuLdLybposfxZrIC/NzCc0Ifzi47CXBjm0CAXtDo93+mD+Hcqgn559R0M9ZS9eJqaVIjiDec5HqT5AIfJaKZFB+yrlxwBM374n81GJh6TOg/BPFRVByZl1u218PzD67xfCPrPl9K9PI9hTfaV6AZDFwC2XaW3y9cSAJEgTqPpM6+Lww5uo5NVxDYIyFN2OE2NlepVgSGbi7X 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)(376014)(7416014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NSiBEpEDosraW7y2C/vfg6C+QiD9PSZL5bNxmJTy8kRA7CZrTx9izf/0pLxfvluYH6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2CxzhDRKdNNxDivgxGngCs4vFjrFJjp1BH19DwtZ4Mz3VMv0Htik6Dt5ZrBk5ts6PW5EpubLPMQps8yJn5vB8lSoRYCRLimup9bJS9uYYKbzwMq5AO2rtWOptQN/GSNaoZGowblMn+xI7pdM/WigmFRqiLeXKutPjCPBissT0DmTBHwwrn8qpmbpPaN86aV0eee8XvQ90GZy3zp8aRYFzLxfHPIPJ9Y4BIs0ic/5DZ4D53eEq6NYfw9hCXoZLG7r5z58fw/a1C6UQfAaG1j6nNWgClFi811/R2vJ7nh9JPGrMN/8OI/rYGvpKdh8PSVYJA5+0dn6+Qxb0Saq0/kJ50p9JyO0iV9Yor6obUVU0pgOGrrrglaOPLunBSRC49qzC4ecZuSgOkDCvYeCa7cUXWBsL76UDCLhmBlC4CPmNlp3afObebCLwbrbttznOxwF9 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: b730bb22-f970-4dea-bba5-08dd313c38c1 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:01:27.7468 (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: 4sUoIQha1/KGDRArrOpqXPrptxemMSj4zkHh9rVrKbHcCLA7H4Qh2MG8jDKW1L/C/2310BEn6e3/oDB3wa7Nbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4132 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: E3AF040008 X-Rspam-User: X-Stat-Signature: oget8efj5yizquygi8nb7txu8p7iyq7o X-HE-Tag: 1736488889-216444 X-HE-Meta: U2FsdGVkX18vp1x780skggiiiwGZGT7fK5FLNCSZUU2KM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pTOT0SCu7muoHIwCijTqDO6bPjdcbAknzn5ofvWR7uW5sZ1nn+NMG2SbvYdx55iUkXJSdvzMzmmXpu9uNuGWabGqxnMMCA5Fb8TAKntAPN89YybLT2Zo90R1sCQbcBXwG8wBWE+A8oDvzTpx9onKV4AWKWVckFpkyjzYRZ699cX+OzfbebLhpVb8mjGDAmxhJIPBzRpSvDQbeMmGvpS00jvNDDHjwvodk1zyBzLAJ/N5F4zE+AdzMWshwTByEhbOlO/C1EUFz0TWMnSaCUOYIz/YMpw8VQl9QRQ+w8RcjCHzVl54Smf09vBitO6LshlHWUTlfuaVa/CpXKWf5wvH6jpGV7HUZooM= 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 Reviewed-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 */