On Thu, Jun 26, 2025 at 05:45:18PM +0100, Robin Murphy wrote: > Indeed that might actually end up pushing things in the opposite direction, > at least in some cases. Right now, a driver with, say, a 40-bit DMA mask is > usually better off not special-casing DMA buffers, and just making plain > GFP_KERNEL allocations for everything (on the assumption that 64-bit systems > with masses of memory *should* have SWIOTLB to cover things in the worst > case), vs. artificially constraining its DMA buffers to GFP_DMA32 and having > to deal with allocation failure more often. However with a more precise and > flexible allocator, there's then a much stronger incentive for such drivers > to explicitly mark *every* allocation that may be used for DMA, in order to > get the optimal behaviour. It really should be using dma_alloc_pages to ensure it gets addressable memory for these cases. For sub-page allocations it could use dmapool, but that's a little annoying because it does coherent allocations which 95% of the users don't actually need.