From patchwork Tue Dec 17 05:13:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13911028 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 9F836E7716A for ; Tue, 17 Dec 2024 05:15:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 22EBC6B009D; Tue, 17 Dec 2024 00:15:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 18E726B009E; Tue, 17 Dec 2024 00:15:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EABFD6B009F; Tue, 17 Dec 2024 00:15:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CAEA06B009D for ; Tue, 17 Dec 2024 00:15:26 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 91FC01A0464 for ; Tue, 17 Dec 2024 05:15:26 +0000 (UTC) X-FDA: 82903287264.11.9DEBE16 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2089.outbound.protection.outlook.com [40.107.94.89]) by imf23.hostedemail.com (Postfix) with ESMTP id B9F5C140004 for ; Tue, 17 Dec 2024 05:15:03 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=uleKcHIq; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf23.hostedemail.com: domain of apopple@nvidia.com designates 40.107.94.89 as permitted sender) smtp.mailfrom=apopple@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=1734412510; 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=sqqmhV31DBHyMlPhdEDkr3XHarfIiD+eK0wQw4RnbHU=; b=Vy88aPj1PD+I6PTRINSJ+A0XBB4AaGhe79wRcz2xgrCjCLLr+2SEz/RecMzW8Md1ZeefKd OEk2OHtVZQ9QnXGeo3PrV1lkjFetCdBV8tUVvK0aDCuQij1N7wRd/C0CyEJ2777ITwHqfU 5UZNQnAO5D7XzLwIvEXHD8Ebbp/Tjvs= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1734412510; a=rsa-sha256; cv=pass; b=jGbBes1oxuHKa7lqU55xbvZbDbKdHAptsIvwydTfm8kgiiU33NqvkMAX4Qv7rHdLFLEW7M oNLMQ/Uihh0JRzRcaEyvrdYKvtXb0ZAZ8ThWJb1Q9ZtYjKvqYbJdZUswHgf2DnGtxJCDFp 9bhyF2cFxA03n40+UuJxr48FrDpSvAc= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=uleKcHIq; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf23.hostedemail.com: domain of apopple@nvidia.com designates 40.107.94.89 as permitted sender) smtp.mailfrom=apopple@nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yCUtPt+MBg3b9H5fYqyN0kNOt+4PJ7Qr/q7MAtFWZWdAyId/Qzb9gBvYeF/w2EpfbxNnoc8HJahROFzEZZhGRaw/Qxpx+clnhEuXsFp161MyYddeYOc2POWfUxYHj3LlvvJbuozi/R+5pl/N5mvzfR+7RkEJKpZYffYEkVys2SXNsC0oCEIlaHtScQ+fa19bh7yiDG7UyR68ys0RPC1Qc4mti/je1vsHwPTkWW5oebMmaq5qLlIJcfr8XSJVLWPzpbho5zmueBAVn79//LRJCBA97pRCEr1ice5oew1No2173/FBuMeDGrEY5X6TbUAR7LV0O6/S7TTgZ0c2CkUOBQ== 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=sqqmhV31DBHyMlPhdEDkr3XHarfIiD+eK0wQw4RnbHU=; b=ZRy+J1MTp3Teg3lt/3j4ncIpdwIogdqWohRd/0//LqRBcp/eqo3SbYOndzOHmJkO46LaEiyl2cxhKEJyBd6VKgPSgg1uzHDw+sls0gOxidRSkJd+CDr2QH4sa0DUL3GYRhDai03fyVP6Kn4D6lYwRI+AY5Fmw3cO91TmrbNhfcFYBK8/b55j7ktjuNRqeidv9oJyVkByV526zqkIHC+i50KOqkH3rMzQpn9+wtCCvL9byxfTqf/96Ou7aB2hitLPjhkD+tnaklsBPfoGdnnIQgMgFLMhyFT3wJ8iv7HsBN7/Fa8vhcynPW9d20ZH4p7g4cN1kBXdLExT051DRAOIiw== 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=sqqmhV31DBHyMlPhdEDkr3XHarfIiD+eK0wQw4RnbHU=; b=uleKcHIqvyHH0z/sxqcHMsOabWIM3e3Uxu4g2YcjPniuMBeeTcRl4ZxpG8ywwXZr4K9o4CHJhZQNQivLpZ0PImQMZx888NVv7CWrFdqudK8qcIbZUaumUpHSM5boZwxlUSL76PfAv8JDTJbFaYmqwduFAeqebB2OodCqxuDgczjhSeVkTzBkeK6UjKHjTRmTG4p0E0nM4a7LgfPZD11lrPkyo8vY2hu/2x9OOoHyxG2i6OxYS8tBdoOl2v/A64ZRREsYX8y7rE+/6IEOy7yBlva/Cu32LphEU+ZBWXT2oht8R4G3aC4ZH35jIZpLZHh0OeVxRF3g+S20XsLyhui1mg== 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:21 +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:21 +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 20/25] mm/mlock: Skip ZONE_DEVICE PMDs during mlock Date: Tue, 17 Dec 2024 16:13:03 +1100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-ClientProxiedBy: SY4P282CA0015.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:a0::25) 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: 86ffab83-0f29-4ba4-5116-08dd1e59cdc7 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: 7HgEDAOC99NQuV/ovjBRbH5pFoleFeQonUkoGmY2N/4PjApSdSmKKOsUIDiaGmA/Jh4fv84mICdWLns8rYN1qSUp7UiAHKTRs6safZdd1pd6PArU3o4iNG5/pxGgzTqYVyAnAF+t/XG1rdJ8aJwp3bPVbZz76Z22oRJaBNQ0QTqatLKks5N2divnyReCWpUdo2/x02l7USyHcR1qPTbskILP0lukLFXUyFJnPyoOPh170dMDHkLe5sZEFZjOxt3i1rSvQMC0p3L3TI3K30mrTEp9Ekv6W/LF+VgSus8+0qMuHN8ZoUeGNENC6zV+rwan47HRgWzpIS/0qGVOF/4E1gRN2/gkdYnTXSEKG96Wy9gh6eL96AANtDSSvdTd5Sd7xlKdaaBTKiBlvAdzIl1osNwUItwIFgClB22B0+Ol81cOEatzwPQ/tjsFnu3k7dGtng/ZNd0WqrCghkJ+mqWKnOpad57m6td2yhVv9s7zkNlCCZUGY5RgXvXFr3XzmTaRaWvo55mRtlEMqOlC0Wl8ozjY3/RMYEc8xOfH3eEkNF4XC6VA9G4oizDr660DTvMlb4CEoj+la8ZEa9tJJbfupVhAhTk9sIcZ1D15wk+Rzner4jvTf/Yb6Q+1JmGReIzx6N9Q74+86Ej94snpazGlkLfcaXYtMqjL9zl2LxgsIhbtd5W12Cf015nJ9SJ5DmgqENJVR2J0G4d5lqlKlxFPb8o29kD3QmJ/zm03VQJMusmWKYhjvJ0hIwsugsr5thSmyoj0WcXsCuAroj1X2pA+ogb8lYby/di9nPVwqDzcdx3pDVWZiUggIu4NVeB4K8JhsfwHF01QB18ZAIfSxVizmsM/07UFKccpzLa7AsX+qiq73jzGp+T423DBRC5Zj0hQcn+hJuXze7Do+V861TBeVg2jTYnvBLa7Mk5D5nG1z0lHgse7XPbXzleP6RgPF6zqFRvIF9OCMThq3MnCkQYb4v9tmM+scYY1QH6SXmPdSdrjFoeAnzTr8VQT88p7NzMnPIoFinQy3Q0g2OnfiOQXYWVUWF/XpwuzWJMObZcw8bKWRx/Uufy299F6J5KT40p+AHRXtpjNSMxgA0TC2Gs3fRGkMeAK/youC9Mhmhuhn+EFmBG90cYIs8x8oYw5B75xicmJpGoNkY83UsJKwI7IZC7pKDIMxWy22W4jZBft44kShs0ffw2VV1rjuoPT80ygOYuoZg0i6KH5P6kS4wXDscodJhuqP2NugKuILE6MGK7eeBquG25fEPk+s9cmDYOOXY9M+r65Q6OqWBpDXwR/xOevVxicmcSjc3E8yOVd09vVRAeWdMfBILmMvpk9ep2r49maQ5D6zSPV7EbFrMs+2cpLG6JmYrckbWFLhTGMS/4d6jhqqQVadrX3iWJsVay2 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: e/r8Lpt3wmfKBo8Wd8mU0bkCob4mw9RLe6rX30uXr6kFHb/X6Sy97Vg3S2NshB8g+WopFrAI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J8/e7ujfnRJgCTd6O+hhjJf8jucMnZwDRA6HcttMQ9vkbhQkHotyiKqvYcCb+WuJ8Fv6XmxjEidS8bXtNC939VxDJtj8T6sxxn2/MFpYNE/O11HaU130xREOZW4bgM0zhzARWRetIIIGu4lWpH2HBCN6GQ7nS8e+dSTolcGBc2c+viiULjq0Pxj9rPzIBHhjb38+N08KRBquuJYsu5ZqYcFaZ+grtV/ptNJUBvpTZf21TYXvhKmV9qDOoIFMUtuFl64P3CIhKY6CoVaLnM4NIOUH9E3TzIF5QSJq3O/aow2FwFZpqXeIz6QBjpafzx5SrhtDYgqcrasV+3zBHxz7qnxQLkJ8p0ELdNfFOzBM1ycdh76oz8yo70Jr2xhHXlac4M54rgMutN1Tye/f/LmpI178yIwR2NEZI7QXGrJlMDCZsyF/OJH X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 86ffab83-0f29-4ba4-5116-08dd1e59cdc7 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:21.0868 (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: vUE5dzK/ieW5Z0sMJKQ4dFadyPVQMFQ7/w4gfzLfjxej3C+xUKede0XbqYdgS5mMhh8WqMMIT0Zhzr8KLNrl2Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4388 X-Stat-Signature: i35b5dssmewiww3zak14inc938qrx6r6 X-Rspamd-Queue-Id: B9F5C140004 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1734412503-854878 X-HE-Meta: U2FsdGVkX1/KkL/mv/a5E0zI7dDAMZmFXdZi+FAL82feHFF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gAr+qfyXWTms7bH/o0S3CodKFgnD5xi1r4u0PzCaN8TIuqsfBMCEM4IAUrkr6dfapxxPCZhtzWTByRTAxHdIXHePSo6SmonQkZ6UbZwxlZ92mkR+p8rVVHTS96m7sJEQWlqQOKV9MiWzeznI66M6A7NEm1qqhq1wzy+kf+b5gsDATGMjLgxJMx0srdyb7fwiMWYuO8c+17hgXDolua4ubN3soKWeWPDD7eiXJB0BrLeAYtA7yYqdG4S7REtSF7TF+B/W9BqKIiAh8nk43lePYB0A3CsxY+TatrtnwCQ20A5rg6ZhwAHTVaCqqvik5s64= 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: At present mlock skips ptes mapping ZONE_DEVICE pages. A future change to remove pmd_devmap will allow pmd_trans_huge_lock() to return ZONE_DEVICE folios so make sure we continue to skip those. Signed-off-by: Alistair Popple Acked-by: David Hildenbrand --- mm/mlock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/mlock.c b/mm/mlock.c index cde076f..3cb72b5 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -368,6 +368,8 @@ static int mlock_pte_range(pmd_t *pmd, unsigned long addr, if (is_huge_zero_pmd(*pmd)) goto out; folio = pmd_folio(*pmd); + if (folio_is_zone_device(folio)) + goto out; if (vma->vm_flags & VM_LOCKED) mlock_folio(folio); else