From patchwork Fri Jan 10 06:00:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13933738 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2075.outbound.protection.outlook.com [40.107.93.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65FA020D519; Fri, 10 Jan 2025 06:03:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736488986; cv=fail; b=A4bbn10D+8U23R1u3RtK4njf41HYd3AQbTG1M3ZGoWZyO79lc73vZwtgGRkdzkEmi2OhUtwvXx1xUwRgLPhKsDMyKtvwonF7WVEe6hytWXfDjSomy7VqTjda6CASoeKjm3oEBi1QZdxS1yYFaWqpg6hGbfa5CQJ+EMeDrgdTJ6E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736488986; c=relaxed/simple; bh=loy8fPKit/qXe324VBogY6o/wKeTCAS31/8tkMWBmTo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=qYl/g4BbsVCVEAQNLSlZgv6Alxsypl5tWYCkEf9dlP6Qfp5NXLM4wdRTvuA0rhzH2afK19nDD3ii0+mx95blKOcoUNOPYimuT8kroH02VhAhGdoIs0pYmBVIzDnt1xwr2wUsA7WfANCcXNXkxW/fHm23PhcfywT0R0ALg+Gxwmk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=QKr+00fB; arc=fail smtp.client-ip=40.107.93.75 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="QKr+00fB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZcCFUIQfTmGAs2iJFzuF8OhJltqNIruYM15wbS+XzYtcB1Ziz/CKQUBrGnJs0vH19fKmzBIVmU5MH+DfYtzvsB9nqiKOU0NeYYyh7SjXhkXT1bQt7AwUTn6lkKC1QeZm2LSy8BDhrzcUY3QW5mijrKC9ua0GZwO6ZEmpNVTtA/SPhcOb8IJGtv2uHLtsLhznEhpMFyyk9BsK4dqG1f2yRGQ3JWC5ykSz28zEZADHoEN2jjtPIt0z+6SxC0soZPJwvLK2s6yZM9MXFHhtCMPnFeYkDxt7i4E62+eZcqEZ4zW01taszeoLWqSMKC1oh5/jsADCTzibM869RcAaqxUdvg== 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=vjp6m1j2W9OFBUPeqNP0AlhzXfJRFG5q0VazBoZoLDo=; b=OoEfWt7qnzdrsso9pqMotrrpUWFGFQ4qXwRRIeQdRjaSbE6tvInhN4c4AGgOIE75AsETpGFHWPLGg1FhdehHEUO6uG2I6bvvq0t+G29+EgvcZLPz3vpICzwWlsHS7NQLfRmj+TdKU06nsSXrPuUcDy18d57th6L108pug6qPs0plz//ode9O3jOFSdo7++Pl35o5aVoC/bwaKqSRwIFnkT/KFNUhbWomUV1cwfM4u94LlNVE3Ru72rcb6vwmVNkFUZ2+PdJ7jmlRfosEKfBpMrCIoizUQFjOs2w/AmvR9WndFT8hBTcUhJxXWgI+1VTFyl5iSWd/cE+Eo86Bkk/o1Q== 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=vjp6m1j2W9OFBUPeqNP0AlhzXfJRFG5q0VazBoZoLDo=; b=QKr+00fBefzYTJp7tq5iChuIrlzvuqh52P6AqX/dqLUUnBG8GsL8urZwTIOj9LRMhyc92vbRp/RAznKicirLxd6+k/DXAVYK40RMNeN15vzkCm4fDpnNuRiyvrRjHazdFuHRZG8TdDPg/XyxA5w2JYu5VX8KzwybR5oa/e5OLU31Ax5ipBzpx4gPBHXll5XdhftLhG1Tij0A1Va8sAuLY3ZUXWsTeJEw/WeYQMPcKbAUtsiju+j01R9lLFE1LfDCC4P3v/kZizC52d7mhc2sYtrbY9r1WadKpFflxuBqTj3KLngdxaPOo+561eiDe3e6M0CCXtYTftgkOiTUMY85cQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) by SA0PR12MB7002.namprd12.prod.outlook.com (2603:10b6:806:2c0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.13; Fri, 10 Jan 2025 06:03:03 +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:03:03 +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 20/26] mm/mlock: Skip ZONE_DEVICE PMDs during mlock Date: Fri, 10 Jan 2025 17:00:48 +1100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-ClientProxiedBy: SY5PR01CA0110.ausprd01.prod.outlook.com (2603:10c6:10:246::8) To DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR12MB7726:EE_|SA0PR12MB7002:EE_ X-MS-Office365-Filtering-Correlation-Id: afa4d788-8ee3-44f5-be5b-08dd313c71b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014; X-Microsoft-Antispam-Message-Info: uS5EiES9d3/74tjwqgbjPXKb1tMMWwLoBPx5/VZ2LB6BO77fx5M2QYCfMBnXIjH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1SNld/ob4jRIFfJ8GxZ26VbX3uUM2E3KpCkT8KEZ91v2HL1nC98iAHFMRhHVe7D7s0kxUpiHrAuPjVhFqg8GkFXVmnQY/kvDmZ2EuiPaz1+JJwvjIbJuo9J63gaSdTcNHGJIo3IAqbKq0vR7UO5MpacuOTEyfqiU7hgS+w8DWtN3XoL6h8h6sFRr3xoMRBVdgPHcSZFFdcIkSm+B8n1WquSTYTW3yEqSZqZcOnUormw0pqpF/cdAsdqnWKR2BotABY4Cnui2qd3nuz2iXcd5Tvd 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)(366016)(376014)(7416014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zotEBBB1qWzkwUK1zoCTCFMKSCY4UHptMeSuxjBNSOLVA0kLB5N9EuVvSEncznjazl++TFXmfUUNkiDhRwjJvatZ+GiZqZzoqdhy2HcGo+iqqSQtGpL+1dDCkHJdK5Csaw4W6M3SiXCTETB4tejQBa+Cww87wCi3E/PzNMv6YIhjTZtY5clTRA7kGmD4hr96kvxh+rdUl458exMavsudjz/8On4bM8AxT1shCqbq6NJTcmp7GEiOgWwHNt+o03WoIUlrTIB0w7mHMcvsrxn6PLQq8FitI2fHJ6q+1KIMRD/YPS6raJ6igqz7PG9QOxJ0xa588i52YJTmUvkSBAPx1ljg+SxF8WL5jUvG2RlR1+ZPys0LwTrOgR7WM85lxNCORMHuW8lfKPJbkUS30tGLVzQuDcC2EaGOALbPM7EuPk6QSMUW7t/jVPGrrCYYE6aWjePcYQ1dKxHAgLGspr6FtCBaB2Av5LdqrAVAPuHiNDYjsDwbjxPCwg0Lm+hxqbvd6p4Mo//NYTDe2ZJzThzBSfogy6ye7q5sDhj0Fz6V/wg06jhBoqhp6ysN5RoP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network-Message-Id: afa4d788-8ee3-44f5-be5b-08dd313c71b8 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:03:03.3250 (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: LG6biLSqoKt4cLY4S8ShavfRhAIL0kQr11bOyLlTWefO8Fvz0a9jMErzwprAX/nSk8i6i2DEdBT13HF4Rat2Zg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7002 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