Re: [PATCH v2 4/4] dma-buf: heaps: add chunk heap to dmabuf heaps

From: Christoph Hellwig
Date: Wed Dec 02 2020 - 08:55:10 EST


On Tue, Dec 01, 2020 at 09:51:44AM -0800, Minchan Kim wrote:
> From: Hyesoo Yu <hyesoo.yu@xxxxxxxxxxx>
>
> This patch supports chunk heap that allocates the buffers that
> arranged into a list a fixed size chunks taken from CMA.
>
> The chunk heap doesn't use heap-helper although it can remove
> duplicated code since heap-helper is under deprecated process.[1]
>
> NOTE: This patch only adds the default CMA heap to allocate chunk
> pages. We will add another CMA memory regions to the dmabuf heaps
> interface with a later patch (which requires a dt binding)

This new heap seems to largely duplicate the exsting cma_heap.c
file. Why can't you reuse the code and allow creating different
heaps with different chunk sizes or max numbers of segments?

> +config DMABUF_HEAPS_CHUNK_ORDER
> + int "Chunk page order for dmabuf chunk heap"
> + default 4
> + depends on DMABUF_HEAPS_CHUNK
> + help
> + Set page order of fixed chunk size to allocate from CMA.

Using a config option for this is just broken. It needs to be runtime
or at very least boot time / DT controllable.

> + * ION Memory Allocator chunk heap exporter

This comment seems wrong.