From patchwork Tue Dec 17 05:13:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13911039 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 2DD91E77187 for ; Tue, 17 Dec 2024 05:16:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F7FE6B00AF; Tue, 17 Dec 2024 00:15:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A5BC6B00B0; Tue, 17 Dec 2024 00:15:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7CF156B00B1; Tue, 17 Dec 2024 00:15:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5D0A96B00AF for ; Tue, 17 Dec 2024 00:15:52 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 27B8516048D for ; Tue, 17 Dec 2024 05:15:52 +0000 (UTC) X-FDA: 82903287768.13.2897586 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2055.outbound.protection.outlook.com [40.107.236.55]) by imf29.hostedemail.com (Postfix) with ESMTP id 18DAC12000F for ; Tue, 17 Dec 2024 05:15:06 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=uiyRjShg; spf=pass (imf29.hostedemail.com: domain of apopple@nvidia.com designates 40.107.236.55 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=1734412517; 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=AoOuGryreVKXelZflkuUcYowBxVEssrOVCkLycDDwBg=; b=q/fNAPHQLgZ5Onv+wvnjp6fYlncRWg7HVY2X1A6qYrHSYK3RwsLtTC85LatkdZMMl0CHUq PYHUDFBBXhiAQXL6dIBfWTEzgRC2mJxQrg4hUSUcqWk8HlFbpnqGvIqvzjH040n8ItE4pp n3lrTJw/shZunlQiBjgI0g68ODbUE0c= ARC-Authentication-Results: i=2; imf29.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=uiyRjShg; spf=pass (imf29.hostedemail.com: domain of apopple@nvidia.com designates 40.107.236.55 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=1734412517; a=rsa-sha256; cv=pass; b=CuLveNLCIcZlJeR+mWWJ1aURicee4xqcHjQ3FeHMKkL5GeoDxIwWb1WmiWheYKv3iNiarJ g8wMjTtrwFNvw+pTG25WG4YfyAmbibbhL2/XFf3lSu6NmGKAcd9NC5my2cN1E3S5VGDRkw T8mKVMCfKvMzUuCvrgUY/hADg2ZyT/A= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lyBt4H1EbMkN6tmc1aSmFYU6s5T4vuIv0JWRJyrSfBeULW4Cv5RFEDxLsb96eIUYhFzDmUQ2cXG+fzy1LCtEOLLLjaoQY+Hpb1xji/7FODDEvR8YBnZDfzO+VrM/EyrpoXpppScgL1jy7bu7ZB4NmUBtJ4p3CZ9ilLxMXgSoz1nXGJ8RGpg33+GhkvTKxdBUtuyvdm8EEyNYrUBIn0X7Bh6BDlIxeb5JWR3/+lDVwCCffO3/2dDbUno5zfC1hWyyfNjl//tciQ9VlKRl1HrVKRczejwlSQPuqYWhMCo2w3mT9b3143JXoNZHb4J8HIK7i9RzGPUbATHmXutHKfT6/Q== 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=AoOuGryreVKXelZflkuUcYowBxVEssrOVCkLycDDwBg=; b=qpEclK2KlRy5qA7Qy/Tp9sieA/txU4nNx58yWRIls7qBksrUm/JtDPXeGQ77HuBn1kBV3mZRXJFnDfWzS14gGWUqcuW0fRs4dRu/yco3x7ZgyyVCp44BlupjN2fKNsdZKVXl8kF2c8ECvWVD5Q2pbQlIuiYpOItSx3fPVwGwJ1kYjMen3vDAtL2G+JgtSOcRshTjvoidKO5xmXRfIQPSGBa8g2wUq8ItL1HAr0z9cIznIPdA3P2YnkRnJlVtrJW+EwOiAThwAZSP0F3OiisSoU5DI/IJ+LSKOH+wdvojg9/whLyjSrW4u+ytcET/WHz5J/Axzssr+biM2gmiUBv70Q== 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=AoOuGryreVKXelZflkuUcYowBxVEssrOVCkLycDDwBg=; b=uiyRjShg8mnPaxUicN4JYeACro5ACR4GDHbFTGpzhLGlh+l0ylSEy1KQcUZGss++ul/WIcL/y4ft9Hh2KrCNJquBft7HlaD3848IBiSu8JQi0b5cJtrirbLMgXKvn1HgyUzF5n8yda3HYh1zG4JG1fP36o33sZ98jj1RZu254gE1c4ZVUUjrAMOrMz080ifVnw73KgaIuyn5dp1Dytm8R0oD+FMfqgEmA7axT7AD2x98sKId1BJx+X4V7UDnptPwUr0RQ/CxLMJ+P7YSW4Ne0wbTvfdQMhZArNKzRmm2rEVWNmj+Yo+GCX/5c3WSKQMRnqmjN9vLxBYH9I/8srD0Mg== 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:06 +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:06 +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 17/25] memremap: Add is_device_dax_page() and is_fsdax_page() helpers Date: Tue, 17 Dec 2024 16:13:00 +1100 Message-ID: <58ea909bd178d97bcc73997d6499880137d5e4ed.1734407924.git-series.apopple@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-ClientProxiedBy: SYBPR01CA0115.ausprd01.prod.outlook.com (2603:10c6:10:1::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_|CH3PR12MB8936:EE_ X-MS-Office365-Filtering-Correlation-Id: 4855ad2a-00fb-4dfc-6a5c-08dd1e59c4cc 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: 6Nu1IFQpacWCV1wkl0/VYFQ76QZEOD4g++H57TJzo7l9Fd40vi+lf+7iG5UlI+sRqqFptDvfsKgebTSLesAlSQWpapsgQJVPsgOhndwFThady9PlBOjil8jpPaZ0JmtZmpZT8cnpq2DADsK2CJJnfhiAEgLZ95ORXNhX90c2OY70yvlqqUyW4pxA/o/JLiAR+KGZ71vYHgkYgIKcrulNZJUjGpUqbPBUyqnIdffyihv+xZ+n88/JDL7Qf23TJrl9qGMysULNakEZWIC91u4mX3x7zVW0eouZ2eevdc/TnTDiTdL4PcvH190O/OPEysxRd/QIsRUfRWp3vF2NQgp8CafkHUbjcALNcxs79JLLccLd2gmUVJW2f7SAmseheFZ6jbo8qb34WnfPmMo4kVUIgUmHNGh8CkCWSdKKBaQ1izTj0L7+TdywLADj6N5QZ0luRIFCL/OTGC3+CyhLy4xwDbgY2U0/HqjysEi6aOk2x7VHg2vWa8OcFhxLdLJdbQMGIqlaIoobMnbAfwCMs3v6XCAceT97K+/v511PL9iK9tPDMPnX3MZNpXPWol7tM7BdYhTAe4kt21p73iJsb6/epDDq0zF/32fOaUir2xKkCEvWfDEfjFJa6vUa+0t6gDtMzh2jNMOmjm1P7iSfrMFF3CYt0DRW7bbN9dp3UCP9l9bx2KSXRuasWoT2q2TlzUTSSmkmL1H54uD9yl5AyP0T3GFGkpbdNxdUb0VmWVDudGt89IUmrBLZvYVImLfCi0SnKXgqKvMYaNq8gLtm1zppgBSyrADiVhgG5g6GBGUcWS4MHJSiSLf124qw+WGGrkGfbMc5IQV3g/uQvlVmdQQYpevzLfL5cCzNijx2HApQ6BLs3VOqwY9DRFy4gXdcJibmD0hVrRcZKYTXPjKbwS9IRBSYp9KoJEAtCfNejb7kES4+SXjcl6EJaFypyjA0T1z4+F4430Ihlq9cbarI6GX66Ja1J2r+nTbcplK4g2X++IqaMDIH/8Q/aSDBdu5HjeZs4Iwo70/iWOBfHA6eYvEkook4CwqhdqY85QJIDl6JPWr2r7ogM6fS8KeDJenvrj8O89qF6WQbTqPQw+TROhRpDdaV8yQ7rQB3F2eFPlwh5V5ofxXR7W7uCY2l7zyhkw6ZaMye0T896qiwyTOdmvBbxYLMSVDMX/xDAI8gH3otlS68cqoAyoohtzvvqX/hTlsuI0y/Hj6yMKzX6AU0w+xTvUJmUWWCf8v/ij84bb9LnbNOPdDkFVFEq9RV/QzUMhEAp1LMv1sBjINQ8VGlZFNzMZuL9rxes9LpnbNpPcOQqswMPlQmoQ9n8Q8W9YfF4HngdSIoJ2ewlYzcUKgw20TsnClQMjG9soVpIPKAqS6dwLLdMAOs3hC5hPWlQlhSUurz 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: RQ4eOaAKwbL3OvTr2BbJLa1CVg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ANx4wciJqk3+8MAeCugFHWK2t2ZFFlKLSyEzMbqqtBQQQmILLA7mVwEaxSiuvsykcTuVeSQ1hZQ80KXG9gajYDE5SGc8MYo+p09DkNzFz+hoWy45y5iB0hf/iYsFpYS1hoSvN0s9VZr6NQBlzZ92cPDxD7bxwOemxopUiJ+jX93VpsBso7OKx8HtSHSnXNG9bl26g61qPbrAHXA0vywCQySgJSYkstD+iBwWbYN9dYxTcMhjlDhgCzh8Td6SaJHXjQbSdjAiUcth3wt587xtk+xk9aJ1sCQ8nM3xAyHrGPX6THvLxF+KdWc/TdfoXMjAY0Atzf+tqglwKjN7FoOetRI3aVX9Gj27JrxA4tIjdkJNd+07THeTmKYhFXeR8uupYwwCAkeMrWZIYtAxEaMgrJiz38kWdavEXpt+F2tMuTETPAsjElSTmNyAZOZObLImnJaHhUrghDbI2dgz/Me7mvW+sxHRo58o88GfMn0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4855ad2a-00fb-4dfc-6a5c-08dd1e59c4cc 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:06.0200 (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: T9JjkO1l8zGrRvsr88jV0aXkaKpAI1WUVXKQs9Uzjq3gIs3oXFpox/Dl91VQ5TYyoEYdSnnT3aZcw+p6PT8VlQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8936 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 18DAC12000F X-Rspam-User: X-Stat-Signature: gspxpxa5tw6wymjw51oyskxarxdkwns4 X-HE-Tag: 1734412506-659196 X-HE-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2Pr5rI2LgKTyaOoFUxujTtLbPgrqN/YcJgxApBeVjvXZ+QOjqNpbJZC/uTPhVoB8sWhyZZl4eWEwYDbezoA0E6Bqz0s9D1fhyyMCwWlBhNfKlog5UIdp6V8/mi0DZSKodoBzrN+Cidyw7TC8RX1JjE7pTi0aBoHKOoKTs/wym4JdMDnMLGUd5o+Al8r/dn3oPEiJoRxeKczUmnYGZAxEpnoTjn83+Lsit2kpt6XlwJrXeFL+zLI2jPK1i6k4y2tE+CnN4mkIqym8U/EDfWjedl/gDa0gVin7JwmbPTu978jOgkLuJ2JQVyKzKqhEXFoJ1pK/OkFrysrLRxvLTbMnaziv+RtNcgACm6t6OGQC3aGAZE= 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: Add helpers to determine if a page or folio is a device dax or fs dax page or folio. Signed-off-by: Alistair Popple --- include/linux/memremap.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/linux/memremap.h b/include/linux/memremap.h index 0256a42..f2a8d13 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -187,6 +187,28 @@ static inline bool folio_is_device_coherent(const struct folio *folio) return is_device_coherent_page(&folio->page); } +static inline bool is_fsdax_page(const struct page *page) +{ + return is_zone_device_page(page) && + page_pgmap(page)->type == MEMORY_DEVICE_FS_DAX; +} + +static inline bool folio_is_fsdax(const struct folio *folio) +{ + return is_fsdax_page(&folio->page); +} + +static inline bool is_device_dax_page(const struct page *page) +{ + return is_zone_device_page(page) && + page_pgmap(page)->type == MEMORY_DEVICE_GENERIC; +} + +static inline bool folio_is_device_dax(const struct folio *folio) +{ + return is_device_dax_page(&folio->page); +} + #ifdef CONFIG_ZONE_DEVICE void zone_device_page_init(struct page *page); void *memremap_pages(struct dev_pagemap *pgmap, int nid);