From 82d8ff8780ab6a6cf1574cc9585f28f724af4a2d Mon Sep 17 00:00:00 2001 From: Piotr Szczepanik Date: Fri, 14 Aug 2020 16:24:15 +0200 Subject: [PATCH] Adjusted default coherent_pool to 2MiB for rockchip64-dev in 5.8.y --- ..._DMA_block_memory_allocation_to_2048.patch | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/patch/kernel/rockchip64-dev/general-increasing_DMA_block_memory_allocation_to_2048.patch b/patch/kernel/rockchip64-dev/general-increasing_DMA_block_memory_allocation_to_2048.patch index dd533639da..fc6c2485b8 100644 --- a/patch/kernel/rockchip64-dev/general-increasing_DMA_block_memory_allocation_to_2048.patch +++ b/patch/kernel/rockchip64-dev/general-increasing_DMA_block_memory_allocation_to_2048.patch @@ -1,13 +1,21 @@ -diff --git a/kernel/dma/remap.c b/kernel/dma/remap.c -index 7a723194e..1a05e9e5b 100644 ---- a/kernel/dma/remap.c -+++ b/kernel/dma/remap.c -@@ -95,7 +95,7 @@ void dma_common_free_remap(void *cpu_addr, size_t size, unsigned long vm_flags) - #ifdef CONFIG_DMA_DIRECT_REMAP - static struct gen_pool *atomic_pool __ro_after_init; +diff --git a/kernel/dma/pool.c b/kernel/dma/pool.c +index 6bc74a2d5..e3827da51 100644 +--- a/kernel/dma/pool.c ++++ b/kernel/dma/pool.c +@@ -164,13 +164,11 @@ static int __init dma_atomic_pool_init(void) + int ret = 0; --#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K -+#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_2M - static size_t atomic_pool_size __initdata = DEFAULT_DMA_COHERENT_POOL_SIZE; + /* +- * If coherent_pool was not used on the command line, default the pool +- * sizes to 128KB per 1GB of memory, min 128KB, max MAX_ORDER-1. ++ * Always use 2MiB as default pool size. ++ * See: https://forum.armbian.com/topic/4811-uas-mainline-kernel-coherent-pool-memory-size/ + */ + if (!atomic_pool_size) { +- unsigned long pages = totalram_pages() / (SZ_1G / SZ_128K); +- pages = min_t(unsigned long, pages, MAX_ORDER_NR_PAGES); +- atomic_pool_size = max_t(size_t, pages << PAGE_SHIFT, SZ_128K); ++ atomic_pool_size = SZ_2M; + } + INIT_WORK(&atomic_pool_work, atomic_pool_work_fn); - static int __init early_coherent_pool(char *p)