On Wed, May 08, 2024 at 06:02:14PM +0100, Pavel Begunkov wrote:
Well, the example fell flat, but you don't use dmabuf when there are no upsides from using it. For instance, when you already have pinned pages, you're going to use pages, and there are no other refcounting concerns.
Sure.
Unless there is an advantage of dmabufs over FOLL_LONGTERM that I don't know about when used with normal user pages.
The advantages of using a dma-buf over FOLL_LONGTERM are:
a) you pre-dma map, which is a significant performance advantage for IOMMU-based setups b) you support any dma-buf exported and not just user memory. This is primarily important for PCIe P2P, but there might be other useful exporters as well
wish io_uring would have just implemented them from the start instead of the current fixed buffers that are not quite as useful by not pre-mapping DMA and not supporting P2P.
fdget(dmabuf) would be horrible, I assume that's not the suggestion.
I'm not even sure what you mean with that.