From patchwork Tue Dec 17 05:13:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13911026 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 9D0ACE77186 for ; Tue, 17 Dec 2024 05:15:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 251856B0099; Tue, 17 Dec 2024 00:15:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 203556B009A; Tue, 17 Dec 2024 00:15:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED3216B009B; Tue, 17 Dec 2024 00:15:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id BE9266B0099 for ; Tue, 17 Dec 2024 00:15:21 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 76854120380 for ; Tue, 17 Dec 2024 05:15:21 +0000 (UTC) X-FDA: 82903287348.29.F7229CD Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2072.outbound.protection.outlook.com [40.107.93.72]) by imf20.hostedemail.com (Postfix) with ESMTP id 4192C1C0006 for ; Tue, 17 Dec 2024 05:14:47 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=s1dA9Za9; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf20.hostedemail.com: domain of apopple@nvidia.com designates 40.107.93.72 as permitted sender) smtp.mailfrom=apopple@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1734412490; a=rsa-sha256; cv=pass; b=3N7cwzkArOs+YZt2v8cgWkU8ab6Xv/AxjRQ4kcsNe0kpRsBN5F4/E575Agkdbvw1hic4Mv vtFIB3TUQJMgn2Bn+eb/U1d4I3k6ZIlVV0aNnp1pF45rRyPlIyjN2kYMBW139m/3Do0fMP RYtUnU+FuOIuC28YjolvNxYwyxLDJck= ARC-Authentication-Results: i=2; imf20.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=s1dA9Za9; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf20.hostedemail.com: domain of apopple@nvidia.com designates 40.107.93.72 as permitted sender) smtp.mailfrom=apopple@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734412490; 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=XTxJojJAl45XFcfTSPH+V2twFdLVZNNNbWJuLt1eZvg=; b=uaKIKnBSvJr1xoRZwKns6Q9d4kAkkbkHkcZo9tGQAqc1SjJZ2gYvAixvHXRGwBEiD6Y+w0 T3B5nYmxT+aeqhuxeaLWFkc17gxSCOSk4nTVVcV5jtFRfzYcxss20rVSv7qBPYTFqm4oxm rfjwNwQogXiu30qbIOdgAiK+duJYUoc= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vPrMavFIfQN8i5I8vcKtybh2R+fAnJxNa0KhCJSmrPCvdrwNmYAWAfwteKtXzUgxePAiCg1xCGiu+gEuQyAfF/9oGNQLQm3m3vAlPu0ucHE32gdXcdSGEPFaMUtKvwx3CpUPCRbAOS8V6CliXFI1N0gI8bUD232t3OfpcS8QrCJhDbO0QpI5iWVnJdnit3jKvNhTTE/ZMUEalTvHfN3o8L5hE0UiO8guUwYsX+0LBSOiw5E1sGAVdyth63XOiXjSMAa9cFJgav0A8c95ll5qN4w49M7hS5BANjOunKOxXiOo+P7ynSYNVdjlKRcul4s/dKY3etbbJPvmFHK6eem0TQ== 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=XTxJojJAl45XFcfTSPH+V2twFdLVZNNNbWJuLt1eZvg=; b=bHZFY0jIDU9ZdB/eofi0wAXUfecaBpboC0GJEy0MB3kE13J37fdDyupGuJNQPI2I3B0Ec7wSac9qg6xt9ogC9djTfX3pVsKAlMnyEnLji9/wIiaHdqysLl6bdxXXvfnF2EtRHgbgZFQo1IewvLeSgz7rtV92ud4pIdkkCQBt8ws/yn/nvFm3q9Rz/eQU909Ykid/qm4uT6rFL4ol+w2r9keokWXZR5UIgcK8C6b58HVYGDxv2+AiVinK7I41KvoCJZ+5bVLNZf7iJSjpa4kWxTgEC8T8oSSJ0FK+VTLQpfCDLI34BH1Zwb6ff/D//EH+VAufm3QklHd3o4C+rFOkhw== 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=XTxJojJAl45XFcfTSPH+V2twFdLVZNNNbWJuLt1eZvg=; b=s1dA9Za97yk5pxpcwmTvHkQ0e2d0aoCfNSIMis/9sPByRxgv0bKVy+5VBgkYqgbu/4q0eLKkljwYsEzyCRVGFjsnRapm9BiQHtpZGfynokNBFjOfoLw6lTBdezetACM6hqWC+VcVNbFSstPcq4XCG8l0ZdEGVt/J7BRWfDjyQhkx6GUcbqAvTnAoY/xJtL3yyfMaz8VAObD9AxG2CRzc/D2y0U8Sz3fod171V2jbq9Z14chIzSjG85FAL6qGx/hANlzTxudLd1drjCWjNWO6o/JyrA9wGgggXwrsLprdB3kPeq0aQFU5UqtoxJFYmkJnO0ACnXhXQB2WiJnYqOUi7g== Received: from DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) by DM6PR12MB4388.namprd12.prod.outlook.com (2603:10b6:5:2a9::10) 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:15 +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:15 +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 19/25] proc/task_mmu: Ignore ZONE_DEVICE pages Date: Tue, 17 Dec 2024 16:13:02 +1100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-ClientProxiedBy: SY6PR01CA0142.ausprd01.prod.outlook.com (2603:10c6:10:1b9::18) To DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR12MB7726:EE_|DM6PR12MB4388:EE_ X-MS-Office365-Filtering-Correlation-Id: 12fdd233-f6c7-4f38-20bb-08dd1e59ca52 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016; X-Microsoft-Antispam-Message-Info: OqV9kVxMvhq9lCGH1RtueYlDFFQByJlhJhvY73LYNtbuqh5seQqpBKAQ2x4APCdayDZDv8cI0YJJO5Yle2wWceRZxllBfBXgpVR55YlHR12ljEY1fhII6FquV7Z03OLDxzlCayTNney5q/wohz66Mk5qZPf8BcmhlTnJLhK/h0moIa8blNfeOVM6akug/539r2OCQHQECo73FZoeMymqHpeA/glfldCb4ZIODmZLFy41/ZB5pnX+U9Ny0NFVrAGl06vG4z8+i2gVBq7EztGpPkNNQtwfNTRr+9S+w6gz6kVL2j9uehGuVNWcHDTQMyy2w5hDotpEvPla6p23CWyJi7gBQF8I2Z/Mmzy50tCbeRU9DjXo/pfc6rqxn2UK6t5DfwBX+nr5K6/e9aY8poxpgUJIGPH2ygUuh+VBKc6FZmFpkjuClEPpo+L0zuOidWakYAlCmfVltxCtQOtz9SSOv2vLvY85jEFfz+mNvl3njmYA2anOiIC7wgbTrMrt5CWqoyn7Uhtk4to2fHkn8xe5hKbC4ihfGPjkFydTklR/SUhkvCvXajNCV3JDV/2q+YEHNDbG6TE1/gvQAvdWOE+bQ2y9kBiH7lobvJbkrVKfi4A6glBKNp9t0fPZWA7GDnOE0qBLU4ccjCGyq8VdVH+dvDczIIgqv4K4iuz+m2mRTcgx059q1TJey6Xvr0Qk12BFgpY7Kpiwh1rujJrLhb6cTFqClrRN+8qaEWqCG+87jXaLkdC4oIAKXedF7PPSwKPj6UDR0q8ovohvAlAHaAzapz1Y1lh4ICcYwbvm0M2a4s7IYNiHOJQm/+q7He3aFx/gQqhKTrhYI1b/kxSA/mmcAjjLJCFF5v8rJtXJrJb0d8vn/XeVAHgpiqGSX7JA9EYaiHwwStIH+ZOJItJ6ybtO11lFlnJtBNpa/UzWvVXt8Lf7H2h1brtxudTwaL8VHbcF2Zxc9RuHtYalTTKzej6PShSDjzjcDfLCu8mUs2vUCKho8E4cx4QDIBpVM4Pcmtq4CRs/YjEnLCcJoPwRhIytN/UU4O+tNqaE4he89YXfiUUQzCzYd78fHvctaqB1ItVlF31YW1WonX+4GxxizPlQ2LR+TpmiO6OuAvSaEqj05WZiepljfdrNx4DcRfleB4yKMFqMcXxD6Hz4Gg7mINqBf2XGC25axE0NZzaXJmkCsrR635b5LbpqEu7MBlvENbYq2FdwJuqy7GNtCscEvVBkGqQujZwDWkwRJa+T8rZTeqxxWtS1gPQxm3YqZwrlQi/fb6ZSnzYWQOQU0jC3UOQD/g9QbHLgBBSkzEHflu2/cEpwaQGPeOMRz11LXN0rMlGdtlhwXTixdPeyXtXnpHicUuKqaAspzo6QgmmpPODdmKahSwYi+kTWZvHcdIxUiSC0 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)(7416014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: h/xBq7B+MynEmKAw6bq21jZivBdax6qs+PwMUfm0erlKqSCOUVStKH7Wbr0a7tEN4oOO9/UvYDHpy+6zwZu0I4DlT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Znfz0UFGQQkUzDptncFBPtP2XkzzHkgg4QI+Q/nS20zhdIpq1xP7ndKWinlSEW+rB/GXtMKDNwnEcjLdelM8AYYtgHC5dr3aPYtc6H2VWmcvfMwRsKYY0U9rwlZFEi25XW1LLP3vKbedK7byUeZEuRdTbE+gH3CXOAU5aP+uAuGy1vPxJKUbE0HNy5xD4TEQ7SLkZM2tPQ26GI78RsHWe31fDcyYiiX7+RsL2cDeiT7iIuF5rIOBR4i1OiuTKG+CqThe+c0j0lNOO81CB3eXCltEfyOmYsOJeDJjynBK8FXyNHmE4KoWzIW0RYpSWAyNM8ObDBwODLWv2XJZHaUfIe6bRmo6qUqXSRSc2Y23Tl5Ig9DGBZZxsAokY3acW7LYDJTSFHbQcASSnULf2QhEdoNCKM6XSUXr+okl0f6Fsu5KVSDDFAwtkAi X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12fdd233-f6c7-4f38-20bb-08dd1e59ca52 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:15.4512 (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: QasNTGvgK8+/JTDoHj5QlSysVJ7DcfjVqJNoGbupQ8gT5CTdQL0uDOQY3AoDujY971O/h9czBOOoqNpEzIkVhA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4388 X-Stat-Signature: 6tf74p4siwtxzt44gf514umr96feshuf X-Rspam-User: X-Rspamd-Queue-Id: 4192C1C0006 X-Rspamd-Server: rspam08 X-HE-Tag: 1734412487-221133 X-HE-Meta: U2FsdGVkX191TEzFcnrMmvjcmbPY+Q0D+TYuX6lxT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Th0msBR9/LsTHrHrOE5HWnKPpdhTcvlze7yDdzPZHstjJVIrgJdQ93W2UYB1+ctWvNiISBpjQcqmZKQfh/BG4Vf5KsG0VJv0Mb7mNWTdl9KzD0hfJKSDGOuy3yz46SJBieYYuqxu4c3zcd6jmR5dYelR81okZl4NL9mQW0SEelRUwkP2CVkQ3thikj8EnAIHEoaqOV1XWeDc4Ofia1ozwiMWSYZrWAvJBMypeLnQgBbzEuluXnwhHjGg5sbw7EwOMUzCa18qbdKpbjQv+w43qbJjO2NA3+AEyCRUu/QaRYazHm3QYrOhcPR1wnEGqAx8xIixon61A4ih/ucfnS4= 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: The procfs mmu files such as smaps currently ignore device dax and fs dax pages because these pages are considered special. To maintain existing behaviour once these pages are treated as normal pages and returned from vm_normal_page() add tests to explicitly skip them. Signed-off-by: Alistair Popple --- fs/proc/task_mmu.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 38a5a3e..c9b227a 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -801,6 +801,8 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr, if (pte_present(ptent)) { page = vm_normal_page(vma, addr, ptent); + if (page && (is_device_dax_page(page) || is_fsdax_page(page))) + page = NULL; young = pte_young(ptent); dirty = pte_dirty(ptent); present = true; @@ -849,6 +851,8 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, if (pmd_present(*pmd)) { page = vm_normal_page_pmd(vma, addr, *pmd); + if (page && (is_device_dax_page(page) || is_fsdax_page(page))) + page = NULL; present = true; } else if (unlikely(thp_migration_supported() && is_swap_pmd(*pmd))) { swp_entry_t entry = pmd_to_swp_entry(*pmd); @@ -1378,7 +1382,7 @@ static inline bool pte_is_pinned(struct vm_area_struct *vma, unsigned long addr, if (likely(!test_bit(MMF_HAS_PINNED, &vma->vm_mm->flags))) return false; folio = vm_normal_folio(vma, addr, pte); - if (!folio) + if (!folio || folio_is_device_dax(folio) || folio_is_fsdax(folio)) return false; return folio_maybe_dma_pinned(folio); } @@ -1703,6 +1707,8 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm, frame = pte_pfn(pte); flags |= PM_PRESENT; page = vm_normal_page(vma, addr, pte); + if (page && (is_device_dax_page(page) || is_fsdax_page(page))) + page = NULL; if (pte_soft_dirty(pte)) flags |= PM_SOFT_DIRTY; if (pte_uffd_wp(pte)) @@ -2089,7 +2095,9 @@ static unsigned long pagemap_page_category(struct pagemap_scan_private *p, if (p->masks_of_interest & PAGE_IS_FILE) { page = vm_normal_page(vma, addr, pte); - if (page && !PageAnon(page)) + if (page && !PageAnon(page) && + !is_device_dax_page(page) && + !is_fsdax_page(page)) categories |= PAGE_IS_FILE; } @@ -2151,7 +2159,9 @@ static unsigned long pagemap_thp_category(struct pagemap_scan_private *p, if (p->masks_of_interest & PAGE_IS_FILE) { page = vm_normal_page_pmd(vma, addr, pmd); - if (page && !PageAnon(page)) + if (page && !PageAnon(page) && + !is_device_dax_page(page) && + !is_fsdax_page(page)) categories |= PAGE_IS_FILE; } @@ -2914,7 +2924,7 @@ static struct page *can_gather_numa_stats_pmd(pmd_t pmd, return NULL; page = vm_normal_page_pmd(vma, addr, pmd); - if (!page) + if (!page || is_device_dax_page(page) || is_fsdax_page(page)) return NULL; if (PageReserved(page))