[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251220040446.274991-8-houtao@huaweicloud.com>
Date: Sat, 20 Dec 2025 12:04:40 +0800
From: Hou Tao <houtao@...weicloud.com>
To: linux-kernel@...r.kernel.org
Cc: linux-pci@...r.kernel.org,
linux-mm@...ck.org,
linux-nvme@...ts.infradead.org,
Bjorn Helgaas <bhelgaas@...gle.com>,
Logan Gunthorpe <logang@...tatee.com>,
Alistair Popple <apopple@...dia.com>,
Leon Romanovsky <leonro@...dia.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Tejun Heo <tj@...nel.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
David Hildenbrand <david@...nel.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Keith Busch <kbusch@...nel.org>,
Jens Axboe <axboe@...nel.dk>,
Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>,
houtao1@...wei.com
Subject: [PATCH 07/13] PCI/P2PDMA: create compound page for aligned p2pdma memory
From: Hou Tao <houtao1@...wei.com>
Commit c4386bd8ee3a ("mm/memremap: add ZONE_DEVICE support for compound
pages") has already supported compound page for ZONE_DEVICE memory. It
not only decreases the memory overhead of ZONE_DEVICE memory through
the deduplication of vmemmap pages, it also optimize the performance of
get_user_pages when the memory is used for IO.
As for now, the alignment of p2p dma memory is already known, setting
vmemmap_shift accordingly to create compound page for p2pdma memory.
Signed-off-by: Hou Tao <houtao1@...wei.com>
---
drivers/pci/p2pdma.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index 70482e240304..7180dea4855c 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -447,6 +447,8 @@ int pci_p2pdma_add_resource(struct pci_dev *pdev, int bar, size_t size,
pgmap->nr_range = 1;
pgmap->type = MEMORY_DEVICE_PCI_P2PDMA;
pgmap->ops = &p2pdma_pgmap_ops;
+ if (align > PAGE_SIZE)
+ pgmap->vmemmap_shift = ilog2(align) - PAGE_SHIFT;
p2p_pgmap->mem = mem;
addr = devm_memremap_pages(&pdev->dev, pgmap);
--
2.29.2
Powered by blists - more mailing lists