From: Christoph Hellwig Subject: Re: [PATCH v6 4/5] dma-buf: heaps: Add CMA heap to dmabuf heaps Date: Thu, 25 Jul 2019 05:45:24 -0700 Message-ID: <20190725124524.GB20286@infradead.org> References: <20190624194908.121273-1-john.stultz@linaro.org> <20190624194908.121273-5-john.stultz@linaro.org> <20190718100840.GB19666@infradead.org> <20190724065958.GC16225@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Benjamin Gaignard Cc: Christoph Hellwig , John Stultz , lkml , Laura Abbott , Sumit Semwal , Liam Mark , Pratik Patel , Brian Starkey , Vincent Donnefort , Sudipto Paul , "Andrew F . Davis" , Xu YiPing , "Chenfeng (puck)" , butao , "Xiaqing (A)" , Yudongbin , Chenbo Feng , Alistair Strachan , dri-devel List-Id: dri-devel@lists.freedesktop.org On Wed, Jul 24, 2019 at 10:08:54AM +0200, Benjamin Gaignard wrote: > CMA has made possible to get large regions of memories and to give some > priority on device allocating pages on it. I don't think that possible > with system > heap so I suggest to keep CMA heap if we want to be able to port a maximum > of applications on dma-buf-heap. Yes, CMA is a way to better allocate contigous regions, but it isn't the only way to do that. So at least for the system default CMA area it really should be a helper for the system heap, especially given that CMA is an optional feature and we can do high order contigous allocations using alloc_pages as well. Something like: if (!require_contigous && order > 0) { for (i = 0; i < nr_pages; i++) page[i] = alloc_page(); goto done; } else if (order > 0) page = cma_alloc(); if (page) goto done; } page = alloc_pages(order);