The current limit default is 128MB, which is a good experience value for I/O reading. However, system administrators should be given a considerable degree of freedom to adjust based on the system's situation. This patch exports the limit to the corresponding area of the dma-heap. Signed-off-by: Huan Yang <link@xxxxxxxx> --- drivers/dma-buf/dma-heap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c index df1b2518f126..2b69cf3ca570 100644 --- a/drivers/dma-buf/dma-heap.c +++ b/drivers/dma-buf/dma-heap.c @@ -417,6 +417,11 @@ size_t dma_heap_file_size(struct dma_heap_file *heap_file) return heap_file->fsize; } +#define DEFAULT_DMA_BUF_HEAPS_GATHER_LIMIT (128 << 20) +static int dma_buf_heaps_gather_limit = DEFAULT_DMA_BUF_HEAPS_GATHER_LIMIT; +module_param_named(gather_limit, dma_buf_heaps_gather_limit, int, 0644); +MODULE_PARM_DESC(gather_limit, "Asynchronous file reading, with a maximum limit on the amount to be gathered"); + static int init_dma_heap_file(struct dma_heap_file *heap_file, int file_fd) { struct file *file; @@ -442,9 +447,8 @@ static int init_dma_heap_file(struct dma_heap_file *heap_file, int file_fd) } heap_file->file = file; -#define DEFAULT_DMA_BUF_HEAPS_GATHER_LIMIT (128 << 20) heap_file->glimit = min_t(size_t, PAGE_ALIGN(fsz), - DEFAULT_DMA_BUF_HEAPS_GATHER_LIMIT); + PAGE_ALIGN(dma_buf_heaps_gather_limit)); heap_file->fsize = fsz; heap_file->direct = file->f_flags & O_DIRECT; -- 2.45.2