summaryrefslogtreecommitdiff
path: root/include/drm
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@igalia.com>2025-10-20 12:54:09 +0100
committerTvrtko Ursulin <tursulin@ursulin.net>2025-10-31 09:14:50 +0000
commit7e9c548d3709c76601c953834bed9c888f3e17b2 (patch)
tree5be5c05175357c70bb8c9c3805f55350714a2867 /include/drm
parent77e19f8d32979f00b7c2cbcb35dbbf6f2116518e (diff)
drm/ttm: Allow drivers to specify maximum beneficial TTM pool size
GPUs typically benefit from contiguous memory via reduced TLB pressure and improved caching performance, where the maximum size of contiguous block which adds a performance benefit is related to hardware design. TTM pool allocator by default tries (hard) to allocate up to the system MAX_PAGE_ORDER blocks. This varies by the CPU platform and can also be configured via Kconfig. If that limit was set to be higher than the GPU can make an extra use of, lets allow the individual drivers to let TTM know over which allocation order can the pool allocator afford to make a little bit less effort with. We implement this by disabling direct reclaim for those allocations, which reduces the allocation latency and lowers the demands on the page allocator, in cases where expending this effort is not critical for the GPU in question. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Cc: Christian König <christian.koenig@amd.com> Cc: Thadeu Lima de Souza Cascardo <cascardo@igalia.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net> Link: https://lore.kernel.org/r/20251020115411.36818-5-tvrtko.ursulin@igalia.com
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/ttm/ttm_allocation.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/drm/ttm/ttm_allocation.h b/include/drm/ttm/ttm_allocation.h
index 7869dc32bd91..8f8544760306 100644
--- a/include/drm/ttm/ttm_allocation.h
+++ b/include/drm/ttm/ttm_allocation.h
@@ -4,7 +4,8 @@
#ifndef _TTM_ALLOCATION_H_
#define _TTM_ALLOCATION_H_
-#define TTM_ALLOCATION_POOL_USE_DMA_ALLOC BIT(0) /* Use coherent DMA allocations. */
-#define TTM_ALLOCATION_POOL_USE_DMA32 BIT(1) /* Use GFP_DMA32 allocations. */
+#define TTM_ALLOCATION_POOL_BENEFICIAL_ORDER(n) ((n) & 0xff) /* Max order which caller can benefit from */
+#define TTM_ALLOCATION_POOL_USE_DMA_ALLOC BIT(8) /* Use coherent DMA allocations. */
+#define TTM_ALLOCATION_POOL_USE_DMA32 BIT(9) /* Use GFP_DMA32 allocations. */
#endif