[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <krs6qfjs2rle2ufoqdk65slnjkq55nbn23reptoij3je4gnb4d@pcbiqtz35hbh>
Date: Thu, 8 Jan 2026 16:14:07 +1100
From: Alistair Popple <apopple@...dia.com>
To: Hou Tao <houtao@...weicloud.com>
Cc: linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
linux-mm@...ck.org, linux-nvme@...ts.infradead.org,
Bjorn Helgaas <bhelgaas@...gle.com>, Logan Gunthorpe <logang@...tatee.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: Re: [PATCH 07/13] PCI/P2PDMA: create compound page for aligned
p2pdma memory
On 2025-12-20 at 15:04 +1100, Hou Tao <houtao@...weicloud.com> wrote...
> 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
Is this true? I wouldn't expect supporting P2PDMA compound pages would change
the vmemmap overhead - I think we'd still need a struct page in the vmemmap
for each 4K of memory unless you were going to prevent anything smaller than a
PMD/PUD sized BAR region from getting mapped.
> , 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