| From 2be74edaa9652ce96639fc5dc750b84877aa4d21 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Thu, 18 Apr 2024 13:56:42 -0400 |
| Subject: drm/amdgpu: Update BO eviction priorities |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| From: Felix Kuehling <felix.kuehling@amd.com> |
| |
| [ Upstream commit b0b13d532105e0e682d95214933bb8483a063184 ] |
| |
| Make SVM BOs more likely to get evicted than other BOs. These BOs |
| opportunistically use available VRAM, but can fall back relatively |
| seamlessly to system memory. It also avoids SVM migrations evicting |
| other, more important BOs as they will evict other SVM allocations |
| first. |
| |
| Signed-off-by: Felix Kuehling <felix.kuehling@amd.com> |
| Acked-by: Mukul Joshi <mukul.joshi@amd.com> |
| Tested-by: Mukul Joshi <mukul.joshi@amd.com> |
| Reviewed-by: Christian Kรถnig <christian.koenig@amd.com> |
| Signed-off-by: Alex Deucher <alexander.deucher@amd.com> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++ |
| 1 file changed, 2 insertions(+) |
| |
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
| index 9e5526046aa15..3af505e8cbbc3 100644 |
| --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
| +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
| @@ -608,6 +608,8 @@ int amdgpu_bo_create(struct amdgpu_device *adev, |
| else |
| amdgpu_bo_placement_from_domain(bo, bp->domain); |
| if (bp->type == ttm_bo_type_kernel) |
| + bo->tbo.priority = 2; |
| + else if (!(bp->flags & AMDGPU_GEM_CREATE_DISCARDABLE)) |
| bo->tbo.priority = 1; |
| |
| if (!bp->destroy) |
| -- |
| 2.43.0 |
| |