diff mbox series

[v2,5/5] dma-buf: heaps: configurable async read gather limit

Message ID 20240730075755.10941-6-link@vivo.com (mailing list archive)
State New
Headers show
Series Introduce DMA_HEAP_ALLOC_AND_READ_FILE heap flag | expand

Commit Message

Huan Yang July 30, 2024, 7:57 a.m. UTC
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@vivo.com>
---
 drivers/dma-buf/dma-heap.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

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;