Re: [RFC: DMA_PMD 00/22] DMA_PMD: PMD_SIZE-backed IO buffer pools
flat view
From: Luigi Rizzo <hidden>
Date: 2026-10-12 15:02:50
Also in:
driver-core, linux-doc, linux-iommu, linux-mm, lkml
On Mon, Oct 12, 2026 at 4:49 PM Mostafa Saleh [off-list ref] wrote:
On Mon, Oct 12, 2026 at 03:51:39PM +0200, David Hildenbrand (Arm) wrote:quoted
On 10/3/26 23:22, Luigi Rizzo wrote:quoted
Here is a subsystem called DMA_PMD on which I would like feedback on architecture, possible enhancements, or kernel components that could be reused to avoid duplication.Here is a feedback to a subsystem called DMA_PMD ;) Why is basing this on PMDs (and embedding it in the name) the right approach? On architctures with large PMDs (512 MiB on arm64 with 64k), would we really want to use 512 MiB pages, or rather something smaller (e.g., 2 MiB) that might possibly also have TLB benefits (cont-pte)?+1 I raised the same point in the LPC talk.
See my other reply, he code makes it clear that the target is reasonably-sized chunks (2M being the obvious choice with 4K PTE/2M PMD, for other cases we need hw support, and it is relatively simple to decouple page size and chunk size.
AFAIK, this series tries to solve both IOTLB pressure and CoCo bouncing at the same time which might be too strict; as for CoCo there is no actual IOMMU, so there is no sizing constraint. Also to reduce bouncing, I think it is sufficient to use the SWIOTLB instead of having a new pool + recycling, the tricky part is how to abstract that to client drivers as this would be needed beyond SKB.
I did have another series to build buffers out of the swiotlb pool https://lore.kernel.org/all/20260824152932.1583506-1-lrizzo@google.com/ (local) but I found it does not scale well under pressure: the existing swiotlb pools use linear search to find an empty region of suitable size, linear scanning when one pool is full, which quickly degrades to O(N) on each allocation. I had some other (not posted) changes to build a buddy allocator on top of the pool (so searching for a slot becomes O(1)) and to spread the search order when a pool is full (avoiding O(N) locking conflicts), but there is a bit of extra overhead in the light-load case. Also it felt like reimplementing the wheel. Overall I think DMA_[NOT_JUST_]PMD is cleaner and superior. cheers luigi
Thanks, Mostafaquoted
-- Cheers, David
-- ----------------------------------------- Luigi RIZZO, rizzo.unipi@gmail.com http://www.iet.unipi.it/~luigi/ Mobile +39-338-6809875 -----------------------------------------