This patchset introduces a new dma heap, "chunk-heap" that makes it easy to perform the bulk allocation of high order pages. It has been created to help optimize the 4K/8K HDR video playback with secure DRM HW to protect contents on memory. The HW needs physically contiguous memory chunks(e.g, 64K) up to several hundred MB memory. To make such high-order big bulk allocations work, chunk-heap uses CMA area. To avoid CMA allocation long stall on blocking pages(e.g., page writeback and/or page locking), it uses failfast mode of the CMA API(i.e., __GFP_NORETRY) so it will continue to find easy migratable pages in different pageblocks without stalling. At last resort, it will allow the blocking only if it couldn't find the available memory in the end. First two patches introduces the failfast mode as __GFP_NORETRY in alloc_contig_range and the allow to use it from the CMA API. Third patch introduces device tree syntax for chunk-heap to bind the specific CMA area with chunk-heap. Finally, last patch implements chunk-heap as dma-buf heap. * since v2 - * introduce gfp_mask with __GFP_NORETRY on cma_alloc - mhocko * do not expoert CMA APIs - Christoph * use compatible string for DT instead of dma-heap specific property - Hridya * Since v1 - https://lore.kernel.org/linux-mm/20201117181935.3613581-1-minchan@xxxxxxxxxx/ * introduce alloc_contig_mode - David * use default CMA instead of device tree - John Hyesoo Yu (2): dt-bindings: reserved-memory: Make DMA-BUF CMA heap DT-configurable dma-buf: heaps: add chunk heap to dmabuf heaps Minchan Kim (2): mm: cma: introduce gfp flag in cma_alloc instead of no_warn mm: failfast mode with __GFP_NORETRY in alloc_contig_range .../reserved-memory/dma_heap_chunk.yaml | 58 +++ drivers/dma-buf/heaps/Kconfig | 8 + drivers/dma-buf/heaps/Makefile | 1 + drivers/dma-buf/heaps/chunk_heap.c | 477 ++++++++++++++++++ drivers/dma-buf/heaps/cma_heap.c | 2 +- drivers/s390/char/vmcp.c | 2 +- include/linux/cma.h | 2 +- kernel/dma/contiguous.c | 3 +- mm/cma.c | 12 +- mm/cma_debug.c | 2 +- mm/hugetlb.c | 6 +- mm/page_alloc.c | 8 +- mm/secretmem.c | 3 +- 13 files changed, 568 insertions(+), 16 deletions(-) create mode 100644 Documentation/devicetree/bindings/reserved-memory/dma_heap_chunk.yaml create mode 100644 drivers/dma-buf/heaps/chunk_heap.c -- 2.30.0.284.gd98b1dd5eaa7-goog