From patchwork Thu Apr 11 00:57:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13625231 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 5420DCD11C2 for ; Thu, 11 Apr 2024 00:58:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE70F6B00A0; Wed, 10 Apr 2024 20:58:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D97CB6B00A1; Wed, 10 Apr 2024 20:58:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C38676B00A2; Wed, 10 Apr 2024 20:58:33 -0400 (EDT) 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 A7C906B00A0 for ; Wed, 10 Apr 2024 20:58:33 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 74A621606EA for ; Thu, 11 Apr 2024 00:58:33 +0000 (UTC) X-FDA: 81995440506.06.F278107 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2099.outbound.protection.outlook.com [40.107.94.99]) by imf08.hostedemail.com (Postfix) with ESMTP id DD84C16000A for ; Thu, 11 Apr 2024 00:58:30 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=JtdSSb8N; spf=pass (imf08.hostedemail.com: domain of apopple@nvidia.com designates 40.107.94.99 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712797111; 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=/XTR2wGTQYyMdv9FC/UxmLCHq78nuoZnJtxOmETBa3s=; b=JchKtrG+r1ev9yOwDEfzl/P/N7vGj2GNTx/q2wtVs+9VtAHrAuagM9ig7WHBnVBhfDzAac q/BM7ak+d5HUD2nUcgfXgj2oCs5T8UHmCuyVwEC9YpKYnWDa+Lcqg4plytAm3YNS0n1+8y IGEBaluqQ1Re4m+107NDXSY5KuNAfK0= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1712797111; a=rsa-sha256; cv=pass; b=URwXfrZZZU2EpymChEYmGZZTmB3nUj/TFWjNdPwk5aCVZn6m4f3PppUGK77408xZfFrUGw QDbUMKNJjEKQ5pqo++Z03ul7H0nqrBTvFQg/CwsuYpCLKmcBGAXu0l4WwIBCuJbqFUh498 JDYS0S/sN4u33TiGmouRRvND9FrJ5Uo= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=JtdSSb8N; spf=pass (imf08.hostedemail.com: domain of apopple@nvidia.com designates 40.107.94.99 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TD3yfIjLf/60rzu2DMfzmmOk+9Je+GLid2cktBFXKhX79/W/mfzvwhKv3SFj4kSDXqyj7wJaP4s1iljoWt00ujqpQB0Df+81UsPvCB+1M4N+nczyaJAYHtaiEqxypY5nN+WrqgtVIKwFSdASxiafv9CVIM+V4We3zAtlMV5I2Kv0y5O57Hovbp8J5vrgHYsJzet3O3ZpboDJl/NTGrIBMneEbMxocO4rQl5WAc+Nf+wsTUJBTqBUB2XinFjgDlSploXNx/Iy7sMgqzhszaUoK81X2inV5ORl6N2pATjcmoZlLtCkPykSmv5vcZi2bFllNvrLTTy3w/d72milELsolw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=/XTR2wGTQYyMdv9FC/UxmLCHq78nuoZnJtxOmETBa3s=; b=XGgVtU2oC5mNAkKLDEhoBGnKgrsHRtSrRdYEYPM+vEhZiwr39wJyj4uNpuflyCDpA8ZDEf+s/6g/USS9292s+8ZLuzd+q+SRw11EihopKX4THc6urvGo0zoHbMOVW75//ib/L0JPbPZmvAZ/vh41D7CHeuijxZ5FgxGYz4VmunNUF3It6CGOVA9YWG2leys12YBHmir4jiN8xZVppJpiqOTwbDH+rcllERRrkD6aXaJ1xVa4uQP9u8N/LxYR36Nl9Aa3vOH7LDSr01HgY8VIUlk5b7KqJ1FoLzftHGDqy2bIBwomS/d3Z/nVm1sLiEOB9jIP2vnFMJfvt/cqcIZZFQ== 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=/XTR2wGTQYyMdv9FC/UxmLCHq78nuoZnJtxOmETBa3s=; b=JtdSSb8NTFOzi51/wzvF2ds75rNXj7APUajn47VmCTGfQADenk/Njks7HiWFcRxr/Q4oLq8lqTN2sLrcMZgwJyShnN++J+faZVYg+hq3TyTkzjW8Ake6f0JMYoCEe/IiajREMaZIXB7TRigVijxcCrPUOx8XOdJqtgnTAkQVWIxboUAUaFaaw6YDh7MAQCo4qgePxIScUSXcPMEDPTFtoO5MgiwwG0SEWRiVnT0bStSetaN42jLb3VY4Fcnj1HMnRHmvAhQ7CgyMPjkdf6f7bB+uPgvD1K96vAfJtMBOrQjADG8ULFo0syjnn5b94u65oY6bBLUAiKA2lV1tlwcVdw== Received: from DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) by DM4PR12MB6182.namprd12.prod.outlook.com (2603:10b6:8:a8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Thu, 11 Apr 2024 00:58:25 +0000 Received: from DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::c5de:1187:4532:de80]) by DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::c5de:1187:4532:de80%7]) with mapi id 15.20.7409.042; Thu, 11 Apr 2024 00:58:24 +0000 From: Alistair Popple To: linux-mm@kvack.org Cc: david@fromorbit.com, dan.j.williams@intel.com, jhubbard@nvidia.com, rcampbell@nvidia.com, willy@infradead.org, jgg@nvidia.com, linux-fsdevel@vger.kernel.org, jack@suse.cz, djwong@kernel.org, hch@lst.de, david@redhat.com, ruansy.fnst@fujitsu.com, nvdimm@lists.linux.dev, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, jglisse@redhat.com, Alistair Popple Subject: [RFC 09/10] mm/khugepage.c: Warn if trying to scan devmap pmd Date: Thu, 11 Apr 2024 10:57:30 +1000 Message-ID: <68427031c58645ba4b751022bf032ffd6b247427.1712796818.git-series.apopple@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: X-ClientProxiedBy: SY5P300CA0056.AUSP300.PROD.OUTLOOK.COM (2603:10c6:10:1fe::20) To DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR12MB7726:EE_|DM4PR12MB6182:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cmonbTBRCOA51WctoFnOuzaMkdzgO5gz6oRLuQYHZ6s1IdGXDxZU9f7gTvrR56NLA6T+EhXzFeogs7rStRTl5U1rVkdM+gTDnQSa28j1l1KVtG2OQQHcHBmfA+27MQKh/JI1Gdty73M7us6KHpLEPJwJmfcX+XUydjCY4zQ1v3wBUXi5eAvU0Z5tS0qFRU69W+aEQNtJIlbppLl6O+kcf4aGld+jGy1or6yuV5XE8MKRvoO1IouGNF22041PIQzBDLlRglEMmP2IJptSIrKeQQEmCieI5C4SxLeqIQcy5JseMW7TM5Nx/1dCEbMsBkw7wcmxFxHorYp7SrHbriy8sQdo3HJwqWFiZa4dyfrnje3zPaKa9NibcGcDp7vZPYJSYzN/jTjC+azoJZle/MhFvstLViItL2TVt2m6Xrf1I+aDwOIdsvAOIibfqz8j3J1icjhrX+ylxGZrSKiSn4vkUnLM/0VwW82f+dsWShO7/k6FKhHs6BtYJuWMg1+8FRNBBnMSw/SRqLQyjIiEFJtMkikno8MVwIh8ZGNmLCTLCP368VaSGP10Yz2WQ4waLpXX2wCmCJpVVRZrdj+GnvFn8qLHiAOh+p6PXRIZFo+rCLqWF8O7E12BqAZ8UHQhnvAN/4zsRtkLNCrlDKK+3RxCoCoalaDXdKiVCby0K7KwDIQ= 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:(13230031)(376005)(1800799015)(366007)(7416005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: klDNgqQyG0ZaTIWUdE82QNzLPmytAQa7CiOzSK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yirbDPKwf1uVAou/PsdkrvveX7QEWn99NW6pVKm4ASkKPX2nsUUlit5GPt1HHPs2Dkr00C32OCpV62z0LLLEO+q7PmIpn18qNidNNjFWfmwXNlvS3Mj5UzRI/mS9YGTmbLf48rhYlxbtjc0di2cAkpQQzs9axmePofZvWKG0wpAAu74te4DAVnZ/JC/yCcguyxdU4dKZdC34eD206KNhAV7jdFkN5+UxdGFPfMf5Qc2xLsfrOx3dkwhz+jBrGz8S/ketbZ6IKPy0CenOw1Pkhe8x2BVg5sm04t8wgK87BOPrBTvuTw7HB58eIiK+791SHkBdP+EFZEowejh/QIqvWDN///63xrXwGa5aYlZDCaai28rEIpHqErRA0eHlYU3JdMQXpr9Ox3MDpj7YU0tmkl6/zbS6d0HF1XWC8gyfRUaHwKi1bk59OrHjzFxmFZraUy2rrPIGwgUPNmusITunzcrmmHO3wu5is8rbVY X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58b41f58-dfd9-48b3-f23a-08dc59c27d7e X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB7726.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2024 00:58:24.4818 (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: vAk0jOaQCaxsAp4+UYf/BQSLAjAtGXPwKGKRe3qGu/c6cRZhg1HKFmfmfrnFZGVgiXQN6saoo2/HTAgLiku8uw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6182 X-Rspamd-Queue-Id: DD84C16000A X-Rspam-User: X-Stat-Signature: am5wy74i6wa4yixui1gadexmh7irzp7a X-Rspamd-Server: rspam03 X-HE-Tag: 1712797110-608012 X-HE-Meta: U2FsdGVkX1/PD1BeCF7jZlTDX5r/NVElxrC6XZLSH14gvennvjCBxuvbhGDcHOIF2klOggJ0UlWMpPOm16PZhDUPo07X+iY2nsXkmEJgEKcA767XxlODj404b2YN0FY2WdqYn0YssM8PKAnPPW5hnWP+ZEVs+p84W0ZDHpqn/+wfGv9XV0u4IXXSTyyBtMafzT5u6B437XMjvJ3EjyZ9+/xz+Xvy7B1ciVV1zoGoA+kyIbUHFcm7Y6RfXySDxm/IW30hdX/ztKKq683bglP4yLgg85+eUirfqAeXDc0a68T3Ccyc9cts2hC6ZxRteMArdhrJdwbLLXiwIEN2oFyPsM8SiOoOeR+CMItcuIsqluwnIc147eGUjuej7MWMCk4Iizp7TPGIpeMcFz8HgsEc5eGf5sp81dukhIXQhC/EPmyY9V2OFUopxnDH0GERu32uLznl6kufrrHk5tAnDdX9OWoRCBeY9u2P0mL22EF8397V+bUpTPB004vz8Ttj9dig2zyL8zh4V7y1FIzCJ+5LWT9QWtPkv4Vld3c3O3kJXNcRHxcOFf3AyUP0V/2+8KNJUwt1S9MfZ1H0RxcGP6pTRhv/F4FWYMTUykn7xesUMq2eMjAv7W7iLJNKkzNIdIB5oc8lxuHquDUGu96TkmbZ8OmIDt02bj+3fmKdKSiQs7xEL0gtb2yEvi2aY+i5xtYJ57Y/MpRnKtXctqV4r78nLiaxl5D6OghoWGpxpyCj2lqpyG0F2CuqSevRUFMdU2ZcCiowpFjJmr4m/KrlOuId0duQD+fapDTq4uQh5TGiBt+KmVZfPD1sTAgtx+mfogVUhMltsPWAJWITjHPFjFku8D+sAKoXRF+qdu3ZrkhHKp9lq1VbNY2xR7jm7o1SJ2VdBn9sZzvDZqL8TAaVu/JGB3HmpRG4LOY0Hyd3A4RcFFcPMTy+3oK0tZVG268bKAVT 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 only user of devmap PTEs is FS DAX, and khugepaged should not be scanning these VMAs. This is checked by calling hugepage_vma_check. Therefore khugepaged should never encounter a devmap PTE. Warn if this occurs. Signed-off-by: Alistair Popple --- Note this is a transitory patch to test the above assumption both at runtime and during review. I will likely remove it as the whole thing gets deleted when pXX_devmap is removed. --- mm/khugepaged.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 88433cc..b10db15 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -955,7 +955,7 @@ static int find_pmd_or_thp_or_none(struct mm_struct *mm, return SCAN_PMD_NULL; if (pmd_trans_huge(pmde)) return SCAN_PMD_MAPPED; - if (pmd_devmap(pmde)) + if (WARN_ON_ONCE(pmd_devmap(pmde))) return SCAN_PMD_NULL; if (pmd_bad(pmde)) return SCAN_PMD_NULL;