Re: [PATCH v6 4/5] dma-buf: heaps: Add CMA heap to dmabuf heaps

From: Christoph Hellwig
Date: Thu Jul 25 2019 - 14:06:56 EST


On Thu, Jul 25, 2019 at 09:47:11AM -0400, Andrew F. Davis wrote:
> This is a central allocator, it is not tied to any one device. If we
> knew the one device ahead of time we would just use the existing dma_alloc.
>
> We might be able to solve some of that with late mapping after all the
> devices attach to the buffer, but even then, which device's CMA area
> would we chose to use from all the attached devices?
>
> I can agree that allocating from per-device CMA using Heaps doesn't make
> much sense, but for global pools I'm not sure I see any way to allow
> devices to select which pool is right for a specific use. They don't
> have the full use-case information like the application does, the
> selection needs to be made from the application.

Well, the examples we had before was that we clear want to use the
per-device CMA area. And at least in upstream a CMA area either is
global or attached to a device, as we otherwise wouldn't find it.