v1 2026-11-07

DMA_PMD大页IO缓冲池 · v1

DMA_PMD 将 2MB 物理连续页以 PDE 级 IOMMU 映射供设备分配器复用,降低 IOTLB 抖动和 bounce buffer,征询架构意见。

原始补丁链接

子 Patch(22)

1/22
iommu/dma: introduce CONFIG_DMA_PMD and metadata table
[Re: [RFC: DMA_PMD 01/22] iommu/dma: introduce CONFIG_DMA_PMD and metadata table] On 10/3/26 2:22 PM, Luigi Rizzo wrote: > diff –git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig > index 6e07bd6946
2/22
iommu/dma: add DMA_PMD pool lifecycle and page recycle hook
添加DMA_PMD池生命周期(dma_pmd_pool_create/destroy)和页回收钩子__dma_pmd_free_page(),挂钩到__free_pages_prepare();异步退役通过WQ_MEM_RECLAIM工作线程,RCU宽限期后释放到伙伴系统。
3/22
mm: Add split_page_compound()
添加split_page_compound(),高阶版split_page(),将大阶页拆分为独立引用计数的复合页,结果冻结供池停放,分发时page_ref_unfreeze。用于DMA_PMD池切割PMD页。
4/22
iommu/dma: add DMA_PMD pool block allocation
添加DMA_PMD池块分配函数(dma_pmd_pool_alloc_bulk_node等),用split_page_compound()切割PMD块,冻结子页,分发时page_ref_unfreeze(),忽略不可选GFP标志,处理__GFP_ZERO。
5/22
iommu/dma: Global cap and shrinker for DMA_PMD pool memory
为DMA_PMD池内存添加全局上限(dma_pmd_max_pages)和shrinker,限制空闲页数量;分配前检查上限,shrinker在回收时退役空闲页,池锁下分离、锁外退役。
6/22
iommu/dma: reserve a per-domain IOVA window for DMA_PMD pages
在iommu_dma_cookie中嵌入dma_pmd_window,记录每域为DMA_PMD保留的IOVA范围,并暴露访问器(dma_pmd_dma_window等)和dma_info_to_prot(),为后续映射层准备。无功能变更。
7/22
iommu/dma: release DMA_PMD domain mappings on domain teardown
添加dma_pmd_domain_release(),在iommu_put_dma_cookie()中调用,安全释放域映射:标记域draining、清除位图、等待srcu,防止竞争unmap访问已释放页表。
8/22
iommu/dma: use per-domain IOVA window to map DMA_PMD memory
使用每域IOVA窗口映射DMA_PMD页,dma_pmd_dma_map_phys()在域位已设时O(1)返回IOVA,首次映射安装PDE_ORDER叶PTE。iommu_dma_map_phys/unmap_phys路由DMA_PMD缓冲区,使unmap为O(1)范围检查。
9/22
iommu/dma: Add DMA_PMD arena allocator
添加DMA_PMD arena分配器,用于dma_alloc_attrs()的长期设备区域。在物理RAM映射IOVA之后保留专用IOVA区域,便于通过IOVA识别arena分配。
10/22
driver core: Add per-device dma_pmd_* sysfs attributes
Add four boolean attributes to struct device exposed under /sys/devices///dma_pmd_*: - dma_pmd_rxbuf: enable DMA_PMD pools for RX buffers / page_pool - dma_pmd_tx_hdrs: enable DMA_PMD pools fo
11/22
dma-mapping: Use DMA_PMD arena for dma_alloc_attrs()
Wire dma_alloc_attrs() and dma_free_attrs() into the DMA_PMD arena when dev->dma_pmd_rings is enabled on a device: - Add dma_pmd_dma_alloc() and dma_is_pmd_dma() backed by dma_pmd_arena. - Rou
12/22
net/core: Use per-CPU DMA_PMD pools for skb_page_frag_refill()
Add sysctl net.core.tx_enable_dma_pmd to back skb_page_frag_refill() with per-CPU order-3 (32KB block) and order-0 (4KB block) DMA_PMD page pools. When enabled, TX socket buffer page fragment allocat
13/22
net/core: Use DMA_PMD for page_pool memory
When dev->dma_pmd_rxbuf is enabled on the pool device, use a per-page_pool DMA_PMD pool for page_pool allocations (__page_pool_alloc_netmems_slow() and __page_pool_alloc_page_order()). When enabled,
14/22
iommu/dma: Support decrypted and pinned DMA_PMD pages
In Confidential Computing (CoCo) guests (AMD SEV-SNP, Intel TDX, ARM CCA), guest memory is private/encrypted by default and DMA buffers must be converted to shared/decrypted in the host page tables be
15/22
iommu/dma: Add background page scrubber for DMA_PMD pools
Add a background scrubber worker (dma_pmd_scrub_work) that zeroes dirty blocks in meta->dirty_bitmap[] and moves them to meta->free_bitmap[], and change __GFP_ZERO (want_init_on_alloc) allocations to
16/22
iommu/dma: Add per-NUMA-node PMD page reservoir
Add a per-NUMA-node reservoir of pre-allocated, pre-zeroed, and pre-prepared 2MB pages (dma_pmd_reservoirs[MAX_NUMNODES]) refilled in process context by a background worker (dma_pmd_reservoir_work):
17/22
net/gve: Use DMA_PMD memory for RX buffers
When dev->dma_pmd_rxbuf is enabled, back GQI-RDA RX packet buffers with a per-queue DMA_PMD page pool (rx->dma_pmd_pool); DQO-RDA uses page_pool, which checks dev->dma_pmd_rxbuf directly. Signed-off-
18/22
net/gve: Use DMA_PMD memory for tx header bounce buffers
When dev->dma_pmd_tx_hdrs is enabled, allocate a MAX_TCP_HEADER bounce buffer per TX slot/packet out of the DMA_PMD arena in raw-addressing mode (both GQI and DQO). When skb_headlen(skb) <= MAX_TCP_HE
19/22
net/mlx5e: Use DMA_PMD memory for tx header bounce buffers
When dev->dma_pmd_tx_hdrs is enabled, allocate a MAX_TCP_HEADER bounce buffer per TX DMA FIFO slot out of the DMA_PMD arena. When the linear portion of a transmitted packet is at most MAX_TCP_HEADER b
20/22
net/idpf: Use DMA_PMD memory for tx header bounce buffers
When dev->dma_pmd_tx_hdrs is enabled, allocate a MAX_TCP_HEADER bounce buffer per TX buffer slot out of the DMA_PMD arena. When the linear portion of a transmitted packet is at most MAX_TCP_HEADER byt
21/22
net/bnxt: Use DMA_PMD memory for tx header bounce buffers
When dev->dma_pmd_tx_hdrs is enabled, allocate a MAX_TCP_HEADER bounce buffer per TX ring slot out of the DMA_PMD arena. When the linear portion of a transmitted packet is at most MAX_TCP_HEADER bytes
22/22
iommu/dma: Add DMA_PMD statistics and debugfs
DMA_PMD pools fail silently. dma_pmd_pool_alloc() returns NULL for four distinct reasons - allocation backoff, the global DMA_PMD page ceiling, an PMD_ORDER allocation failure, and a split_page_compou