From patchwork Thu Jun 27 00:54:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13713597 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 5B5AAC30653 for ; Thu, 27 Jun 2024 00:54:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE75D6B0089; Wed, 26 Jun 2024 20:54:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D97536B0099; Wed, 26 Jun 2024 20:54:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC29A6B009A; Wed, 26 Jun 2024 20:54:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 97CF56B0089 for ; Wed, 26 Jun 2024 20:54:57 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 48AC7C17AF for ; Thu, 27 Jun 2024 00:54:57 +0000 (UTC) X-FDA: 82274849034.20.EEA7677 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2083.outbound.protection.outlook.com [40.107.220.83]) by imf19.hostedemail.com (Postfix) with ESMTP id 807FE1A0010 for ; Thu, 27 Jun 2024 00:54:54 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=MKbrl7oA; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf19.hostedemail.com: domain of apopple@nvidia.com designates 40.107.220.83 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719449677; 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=hPINMew12P57zfDMgYtT5iZzwuOu+WVIYwPZgbZaNX4=; b=WbcZ+k1Fbz8tXxl/LeiUH2Sxl1rlrYl7bmRqQpjmq1JJ2gna9v+/bkBFB6wJrc40lWHzbT //+YZ7DmQ2Iadr5Pw30oYpDms4MZ/aXgJqBHCJzDu0tnK3lyZBwCjh5nt7Dp/P+7nmVzyz flrE7ZMRbJ/otWmtl8Xn4N6r7zc6zxE= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1719449677; a=rsa-sha256; cv=pass; b=4JpOeL8vVX8KBmepAvJnJVmLtecqjHmB/IBu7nW5xYy3EeIQhvb/2wHuTypLdLSq08BQAC Q1decVOlu+z3MPKcC2mJkLY7MkvexB3OB3LkwoPUg1bGAJXctGnJuj4jXsYcp7NnSTW/rv yVaTdOHgont3QN+s6QDpPRIb3C6GyoY= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=MKbrl7oA; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf19.hostedemail.com: domain of apopple@nvidia.com designates 40.107.220.83 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ise+SBxARSC6WeEfZY+AMCfhueZMC14HH/5SWS6IEv82/YZhMu/2x9KC835gKUlFzL6lkKvtiTeeZ2ppsoUMBc4emMlKbU34RMFbkWQ6pZK/e61wLeZALeSJWEXgpUlPnLYZlx7fVaar16e0ahcXeimfW0g8iyql6iSJVuhBdRhXlb5ymFuMpfh6SeFapBd45+kCYxb6HVuoYoKJAtcCLNZfDekDO1A4m8MbrjstH/55/RVwLh+pa331j39uYq0sQtnncAYfHmlvMM4iDvGN7oRJky8dl9dMtdj6Z2bThExt/s3SS7R6HXeHsrdCr7WYIh2XDfPx1iS153SlESVn1Q== 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=hPINMew12P57zfDMgYtT5iZzwuOu+WVIYwPZgbZaNX4=; b=KnMUDCktLAUYRcVcN4FK1gWkMU8+c/6BCGeDNaIXUSrHCT8zdrgTy3TTX3kQdPaLONyqyANlH47NV9GxkTOMhy309ENEbAID37lIhGbjb3irQ23QzO8hK9ibBZx902a5IBKVXa4A88iruLzq1jGLiQz7qTSqeLaoBDlrQ/T2UXI8JInxGmo4qLZrNmFhDzlBMFgEQ1FUj3Yz6yQOO0q0Z7LIQLPfseewNoRak1UOeg9K28iFcywqXqAhFlVKIIVMV+h3bYLshS5p5BNjlLu7CNi29C60fOgfxB1uwAUUAruy1Goe+DURaAtzJtac0lxIwrcqun2lGXgZfVkrvWzPwA== 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=hPINMew12P57zfDMgYtT5iZzwuOu+WVIYwPZgbZaNX4=; b=MKbrl7oAuTukBefV/i0h5Lox/fZzcnZphErp6EzXGQU4P48O1JF5tNblAbRroMtoTf1jIBYwlCEy4XwG4AOD6XUDxsAHWNayrwoVMp4xqWWmtW9F6oKepxDwg6uaoynUumpU+WQJyOacwJsfjtqjQyv/MGLxYkjpNnafqbSwK31fUgKVxlwEfIWtCutpVAJT2m93jIipE6NghjyxZRJjMcOffb2PUuvf9RkrxrC4Is1jtHZB1gqKKdJ0G9SJ6W062ewo+ghzLdYAO48dqq8maoNdzsds1ZjdQ3rzgy3RC0fr4cL7mV7fae98WVENhJsvgHjj4Yadk32g/HH8nkmPdA== Received: from DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) by MW6PR12MB7071.namprd12.prod.outlook.com (2603:10b6:303:238::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.32; Thu, 27 Jun 2024 00:54:45 +0000 Received: from DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe]) by DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe%6]) with mapi id 15.20.7698.025; Thu, 27 Jun 2024 00:54:45 +0000 From: Alistair Popple To: dan.j.williams@intel.com, vishal.l.verma@intel.com, dave.jiang@intel.com, logang@deltatee.com, bhelgaas@google.com, jack@suse.cz, jgg@ziepe.ca Cc: 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-mm@kvack.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, jhubbard@nvidia.com, hch@lst.de, david@fromorbit.com, Alistair Popple Subject: [PATCH 02/13] pci/p2pdma: Don't initialise page refcount to one Date: Thu, 27 Jun 2024 10:54:17 +1000 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: X-ClientProxiedBy: SY8P282CA0027.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:29b::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_|MW6PR12MB7071:EE_ X-MS-Office365-Filtering-Correlation-Id: a088fd23-3d58-498c-b9df-08dc9643bc69 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|7416014|1800799024; X-Microsoft-Antispam-Message-Info: 2rnjoSObMFwM/09/5eFhgMLvM9L+tP1OpHzVCRUD+b//b3o+zAKbBR6M8Cxsi/1zpANC4vzOcld4Y1SwplXFQyZqGVqnnNzu1TQT94314P7IjxZATsYGrBUruBKy2pgcQXerLFwu+HmZz8jwgdCd3BL5n5p+k6z37SnB90gWWPY3yRof/eGDPXKVS2+BypI0F3XCl1MVJfbLtAJYuGTvl/rAVXGWKhnLlXCUb/ZR2pmIY92rSoMxDas3giww+mUF9rpPwDjAz9q9svCQ80CF3QwqpdZw96x2DDFlPPR2NfthYJdby34gv6Ss8pF2CTgOgF0ez3kyeabWD8ZosV5S2KunsFFa3OixLgo7YetBGaNU013R1WcgNhgrGldS4boXubhGyC3MREZO2c30HeIt4q3ywLNRVZvc86sUhuhE93EFxDigkeCQ+OERFAb6iTVYnYQCFlS0zcXZN+0wE62ztEpgEb28C35JPzRLch3l0NfJl4pf2FZa9kfnniXKzrzS/tY6TTVn6h+jJCPHnXkZrgVeqyKt2P0INQFaU04iGypW7uqUUdCLuGwbXrzmd+sXem1GJ2lHKE1bTlnFknpquo+nz9hIlqEF5APak7UxpCeyTRiXWLH1dOcKszUz6OjC0Owq0qT7Ns/8t2RvKTUJGoiSDBsij4QQR/NaMdyzotFKgj7kv4IA6pc3LL9PgI8Xu4BKAv8b/TJoV+rBxuy1wKscpblqkUeBwR1Ox8R+nzQfkrxPRBC+jSAvoN5sDnZbt0GFkOqtZPrpqZqZlO3+2j1SbdeRey6PvE1OBfUe/nOAJ8C4XB2UwBRuVJSRzvU7FrMzHN47LfVfmLNEYSGnC5+//nX7bThXEKUBqRDMLEbRG6UDUshXMEzHuCy2N19WC1x2/B+h9j77iK9Sh3hI/fp5TBNTpvj14SuZlS1UUq3y5VLuZp5Ndh9CcM+dxYOgUkgeLyePWoIJZw9Bj0EKXa+Xlej5myHPvfS2mTXn5YUfXdZiVfAk5fmohYSarTBWAw4YWGGOx/IXc/BhmzbRodDLig1+WUJ0ceH7D/HT799bHhuszaU0HafBkpdHUmRmhjdLImJ6FbxLMDrEgo8Evxg2E7VU3Ij6dP0zpN36amIjSrVanFpf9/q9b6vNwFRCAKW7EnI4p6WCdtfLI3eR33kk/DjJMkOKdR8dmJi+TVAr/PxnFmxUkjnId2BHydgeswm5KlsAAMRibFiE/+azmyn7sUQ8fbb7JEkvSUP8Usj6rHike0at9tF5/mzVe5LWnRfCpRNDTxtg2+SPJBayHbdv/Z+parbFb4tt4gKlRSZKsiebLtnmYCsKEOmZ1YzNuyx6dbck4aFmLZSupNoWBA== 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)(366016)(376014)(7416014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dNGSkOh98qimkmddEaJLkyU01T88pufhRnad9b1L0rEZjeNZgJXMlUkh4pu0ch8AuZa3p/r+dvy35NbnSws6NbpVwdl7FwXGiwpR4ZC+4NGdvyyCSlTcHPL2fW+cuK0ZeRyqIOtdHLBloIqKe9XuW0289A7M+xEBCt3S0OjkqvG4D7aSdtmIalekRZEfq+lSWmWRz0yAiqz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bfnN//g9sxrTwemlj1mOBYxP+LuJzI14nCpE/QjqYZtkHrhiEvp8fAtcA46VSQxlXCJzHgrtZ9E3L/fM2LA67hcdBHErPy/6ccAXuZWMRJFjvBAPJHbOawWAHl4FJtofKE0kwmAGaNYit1ecXwHndyFj7avsK3pvKbcIjlzb/BFJF13aD8L3O1eiJ+SLWFQodweT2l96gKBTdkb4kzODF0J+V4XZm2cng1VSscvl56QTyKSeJxAzbuu7jN2uoW3Gz0k1BhAcAOsOL52AoClBqCRj4rjK4TtnMBjNJv+MQuxVC0pVqKBDJGwdDIE X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: a088fd23-3d58-498c-b9df-08dc9643bc69 X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB7726.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2024 00:54:45.0710 (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: kQwjgjMduH9IypZxLKV8hTKTor7kJVJeIzIw5djaLarYMfmJzrqPzmexitrN5JA/pccHPBErrEpxegO3X/nq+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7071 X-Stat-Signature: p4qe8mm4kqwo9rk61cj8p5z1hrs6y7d1 X-Rspamd-Queue-Id: 807FE1A0010 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1719449694-328274 X-HE-Meta: U2FsdGVkX18l9T2ylecbcBWCzZNbnfwjkiDiEa+VksQe4OZYryXR5mzqJScVQmFSJPgzWvNdehvYLRhPCBUf7JexlhPLkK4sk8neDpo4Sr2lpVFsF0lkTqWON4SkGIt5Wo7hm4BGQt3nCwHLfLmmLLgg2v59xT+uozmqRHxl/v6fsxd5z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A504IygGIGeOEWMebK+TrtAi2PZYo= 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 reference counts for ZONE_DEVICE private pages should be initialised by the driver when the page is actually allocated by the driver allocator, not when they are first created. This is currently the case for MEMORY_DEVICE_PRIVATE and MEMORY_DEVICE_COHERENT pages but not MEMORY_DEVICE_PCI_P2PDMA pages so fix that up. Signed-off-by: Alistair Popple --- drivers/pci/p2pdma.c | 2 ++ mm/memremap.c | 8 ++++---- mm/mm_init.c | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c index 4f47a13..1e9ea32 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -128,6 +128,8 @@ static int p2pmem_alloc_mmap(struct file *filp, struct kobject *kobj, goto out; } + set_page_count(virt_to_page(kaddr), 1); + /* * vm_insert_page() can sleep, so a reference is taken to mapping * such that rcu_read_unlock() can be done before inserting the diff --git a/mm/memremap.c b/mm/memremap.c index 40d4547..caccbd8 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -488,15 +488,15 @@ void free_zone_device_folio(struct folio *folio) folio->mapping = NULL; folio->page.pgmap->ops->page_free(folio_page(folio, 0)); - if (folio->page.pgmap->type != MEMORY_DEVICE_PRIVATE && - folio->page.pgmap->type != MEMORY_DEVICE_COHERENT) + if (folio->page.pgmap->type == MEMORY_DEVICE_PRIVATE || + folio->page.pgmap->type == MEMORY_DEVICE_COHERENT) + put_dev_pagemap(folio->page.pgmap); + else if (folio->page.pgmap->type != MEMORY_DEVICE_PCI_P2PDMA) /* * Reset the refcount to 1 to prepare for handing out the page * again. */ folio_set_count(folio, 1); - else - put_dev_pagemap(folio->page.pgmap); } void zone_device_page_init(struct page *page) diff --git a/mm/mm_init.c b/mm/mm_init.c index 3ec0493..b7e1599 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -6,6 +6,7 @@ * Author Mel Gorman * */ +#include "linux/memremap.h" #include #include #include @@ -1014,7 +1015,8 @@ static void __ref __init_zone_device_page(struct page *page, unsigned long pfn, * which will set the page count to 1 when allocating the page. */ if (pgmap->type == MEMORY_DEVICE_PRIVATE || - pgmap->type == MEMORY_DEVICE_COHERENT) + pgmap->type == MEMORY_DEVICE_COHERENT || + pgmap->type == MEMORY_DEVICE_PCI_P2PDMA) set_page_count(page, 0); }