Re: [PATCH v2 RESEND 4/7] swiotlb: Dynamically allocated bounce buffers

From: Christoph Hellwig
Date: Wed May 17 2023 - 02:57:06 EST


Just thinking out loud:

- what if we always way overallocate the swiotlb buffer
- and then mark the second half / two thirds / <pull some number out
of the thin air> slots as used, and make that region available
through a special CMA mechanism as ZONE_MOVABLE (but not allowing
other CMA allocations to dip into it).

This allows us to have a single slot management for the entire
area, but allow reclaiming from it. We'd probably also need to make
this CMA variant irq safe.

This could still be combined with more aggressive use of per-device
swiotlb area, which is probably a good idea based on some hints.
E.g. device could hint an amount of inflight DMA to the DMA layer,
and if there are addressing limitations and the amout is large enough
that could cause the allocation of a per-device swiotlb area.