[PATCH 12/13] drm/amdgpu: transferred bo doesn't use vm lru

Chunming Zhou david1.zhou at amd.com
Wed May 9 06:45:42 UTC 2018


Change-Id: I1179a21aa3712b095fd50bed6956654e0f72e611
Signed-off-by: Chunming Zhou <david1.zhou at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 537f04d25535..a425d498f3fc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -255,9 +255,15 @@ void amdgpu_vm_add_to_lru(struct ttm_buffer_object *bo)
 	struct ttm_bo_device *bdev = bo->bdev;
 	struct amdgpu_bo *abo = ttm_to_amdgpu_bo(bo);
 	struct amdgpu_vm_lru *vm_lru = abo->vm_lru;
+	struct ttm_mem_type_manager *man;
 
 	if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) {
-		if (bo->resv == vm_lru->resv)
+		if (bo->destroy == ttm_transfered_destroy) {
+			BUG_ON(!list_empty(&bo->lru));
+
+			man = &bdev->man[bo->mem.mem_type];
+			list_add_tail(&bo->lru, &man->lru[bo->priority]);
+		} else if (bo->resv == vm_lru->resv)
 			amdgpu_vm_bo_add_to_rb(abo, &vm_lru->fixed_lru[bo->mem.mem_type][bo->priority]);
 		else
 			list_add_tail(&bo->lru, &vm_lru->dynamic_lru[bo->mem.mem_type][bo->priority]);
@@ -297,6 +303,8 @@ void amdgpu_vm_del_from_lru(struct ttm_buffer_object *bo)
 	struct amdgpu_bo *abo = ttm_to_amdgpu_bo(bo);
 	struct amdgpu_vm_lru *vm_lru = abo->vm_lru;
 
+	if (bo->destroy == ttm_transfered_destroy)
+		return;
 	if (amdgpu_vm_bo_rb_find(&vm_lru->fixed_lru[bo->mem.mem_type][bo->priority],
 				 abo->index)) {
 		rb_erase(&abo->node,
@@ -311,6 +319,8 @@ void amdgpu_vm_move_to_lru_tail(struct ttm_buffer_object *bo)
 	struct amdgpu_vm_lru *vm_lru = abo->vm_lru;
 	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev);
 
+	if (bo->destroy == ttm_transfered_destroy)
+		return;
 	if (bo->resv == vm_lru->resv)
                list_move_tail(&vm_lru->vm_lru_list, &adev->vm_lru_list);
 }
-- 
2.14.1



More information about the amd-gfx mailing list