]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: Configure max beneficial TTM pool allocation order
authorTvrtko Ursulin <tvrtko.ursulin@igalia.com>
Mon, 20 Oct 2025 11:54:10 +0000 (12:54 +0100)
committerTvrtko Ursulin <tursulin@ursulin.net>
Fri, 31 Oct 2025 09:14:50 +0000 (09:14 +0000)
Let the TTM pool allocator know that we can afford for it to expend less
effort for satisfying contiguous allocations larger than 2MiB. The latter
is the maximum relevant PTE entry size and the driver and hardware are
happy to get larger blocks only opportunistically.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Alex Deucher <alexander.deucher@amd.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-6-tvrtko.ursulin@igalia.com
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

index 7b144ddea268f15dccd2cf2ade92ea106cab266e..8e82163981f4680be7725edfb79d5fcccb0eb396 100644 (file)
@@ -1837,7 +1837,7 @@ static int amdgpu_ttm_pools_init(struct amdgpu_device *adev)
        for (i = 0; i < adev->gmc.num_mem_partitions; i++) {
                ttm_pool_init(&adev->mman.ttm_pools[i], adev->dev,
                              adev->gmc.mem_partitions[i].numa.node,
-                             0);
+                             TTM_ALLOCATION_POOL_BENEFICIAL_ORDER(get_order(SZ_2M)));
        }
        return 0;
 }
@@ -1933,7 +1933,8 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
                               (adev->need_swiotlb ?
                                TTM_ALLOCATION_POOL_USE_DMA_ALLOC : 0) |
                               (dma_addressing_limited(adev->dev) ?
-                               TTM_ALLOCATION_POOL_USE_DMA32 : 0));
+                               TTM_ALLOCATION_POOL_USE_DMA32 : 0) |
+                              TTM_ALLOCATION_POOL_BENEFICIAL_ORDER(get_order(SZ_2M)));
        if (r) {
                dev_err(adev->dev,
                        "failed initializing buffer object driver(%d).\n", r);